switch to CMake

This commit is contained in:
Martin Michelsen
2021-12-29 11:51:17 -08:00
parent 6b5766449e
commit e8f23e4b2e
62 changed files with 253 additions and 326 deletions
+50
View File
@@ -0,0 +1,50 @@
#include "PSOProtocol.hh"
#include <stdexcept>
using namespace std;
uint16_t PSOCommandHeader::command(GameVersion version) const {
switch (version) {
case GameVersion::DC:
case GameVersion::GC:
return reinterpret_cast<const PSOCommandHeaderDCGC*>(this)->command;
case GameVersion::PC:
case GameVersion::Patch:
return reinterpret_cast<const PSOCommandHeaderPC*>(this)->command;
case GameVersion::BB:
return reinterpret_cast<const PSOCommandHeaderBB*>(this)->command;
}
throw logic_error("unknown game version");
}
uint16_t PSOCommandHeader::size(GameVersion version) const {
switch (version) {
case GameVersion::DC:
case GameVersion::GC:
return reinterpret_cast<const PSOCommandHeaderDCGC*>(this)->size;
case GameVersion::PC:
case GameVersion::Patch:
return reinterpret_cast<const PSOCommandHeaderPC*>(this)->size;
case GameVersion::BB:
return reinterpret_cast<const PSOCommandHeaderBB*>(this)->size;
}
throw logic_error("unknown game version");
}
uint32_t PSOCommandHeader::flag(GameVersion version) const {
switch (version) {
case GameVersion::DC:
case GameVersion::GC:
return reinterpret_cast<const PSOCommandHeaderDCGC*>(this)->flag;
case GameVersion::PC:
case GameVersion::Patch:
return reinterpret_cast<const PSOCommandHeaderPC*>(this)->flag;
case GameVersion::BB:
return reinterpret_cast<const PSOCommandHeaderBB*>(this)->flag;
}
throw logic_error("unknown game version");
}