DecompilerException.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (C) 2022 The V-Gears Team
  3. *
  4. * This file is part of V-Gears
  5. *
  6. * V-Gears is free software: you can redistribute it and/or modify it under
  7. * terms of the GNU General Public License as published by the Free Software
  8. * Foundation, version 3.0 (GPLv3) of the License.
  9. *
  10. * V-Gears is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. */
  15. #include "decompiler/DecompilerException.h"
  16. #include "installer/support/scummsys.h"
  17. UnknownOpcodeParameterException::UnknownOpcodeParameterException(std::string param){
  18. what_ = "Unknown opcode parameter string: " + param;
  19. }
  20. const char* UnknownOpcodeParameterException::what() const noexcept{return what_.c_str();}
  21. UnknownConditionalOperatorException::UnknownConditionalOperatorException(unsigned int address, unsigned int op){
  22. what_ = "Unknown conditional operator: " + std::to_string(op) + " at address " + std::to_string(address);
  23. }
  24. const char* UnknownConditionalOperatorException::what() const noexcept{return what_.c_str();}
  25. UnknownOpcodeException::UnknownOpcodeException(uint32 address, uint32 opcode): address_(address), opcode_(opcode){}
  26. const char* UnknownOpcodeException::what() const noexcept{
  27. sprintf(buffer_, "Unknown %s (address: 0x%08x, opcode: 0x%04x)", Type(), address_, opcode_);
  28. return buffer_;
  29. }
  30. const char* UnknownOpcodeException::Type() const{return "Opcode";}
  31. UnknownJumpTypeException::UnknownJumpTypeException(unsigned int address, unsigned int opcode){
  32. what_ = "Unknown jump type: " + std::to_string(opcode) + " at address " + std::to_string(address);
  33. }
  34. const char* UnknownJumpTypeException::what() const noexcept{return what_.c_str();}
  35. UnknownSubOpcodeException::UnknownSubOpcodeException(unsigned int address, unsigned int opcode)
  36. : UnknownOpcodeException(address, opcode){}
  37. const char* UnknownSubOpcodeException::Type() const{return "SubOpcode";}