diff options
| author | Nicholas Estelami <NEstelami@users.noreply.github.com> | 2021-01-23 14:23:51 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-23 14:23:51 -0500 |
| commit | ee42172389c0aebfbc0c2d5bbabab4ec858bc8cd (patch) | |
| tree | 3c6afd903bb9983602f6f79a1333106fe2306745 /ZAPD/ZDisplayList.h | |
| parent | 2e1174063f3ed6bcf929bc7093cd2d1b05f8518b (diff) | |
WIP F3DEX Support, Bug Fixes, Game definable in XML (#75)
* WIP F3DEX support
* Additional work on F3DEX support, fixed bug with actorlist
* Fixed crash bug
* Adds ZFile attribute "Game" to be able to change the game mode for ZAPD.
* Additional changes to support F3DEX
* Fixed bug with cullDL and with dlist type selection
* F3DEX Opcode fix
* Fixed up a few bugs
* Cleaned up some code and fixed bug with directory creation.
* ZAPD now supports correct bitpacking for gsSPSetOtherMode on F3DEX
* Fixes syntax error in ZDisplayList.h
* Updates Actor and Object Lists
* Updated actor and object list
* G_MTX updated for F3DEX
* Fixed bug with transition actor list
* Updated G_Texture for F3DEX
* SW97 maps: Removes actor 0x22, and shifts actors 0x23 and above down by one to match retail enum.
* Fixes issue in reuse of actorCount variable in SetActorList::GetActorListArraySize.
Co-authored-by: Kenix3
Diffstat (limited to 'ZAPD/ZDisplayList.h')
| -rw-r--r-- | ZAPD/ZDisplayList.h | 90 |
1 files changed, 89 insertions, 1 deletions
diff --git a/ZAPD/ZDisplayList.h b/ZAPD/ZDisplayList.h index dcfe6bb..06b34a8 100644 --- a/ZAPD/ZDisplayList.h +++ b/ZAPD/ZDisplayList.h @@ -9,6 +9,60 @@ #include <map> #include <string> +enum class F3DEXOpcode +{ + G_SPNOOP = 0x00, + G_MTX = 0x01, + G_MOVEMEM = 0x03, + G_VTX = 0x04, + G_DL = 0x06, + G_LOAD_UCODE = 0xAF, + G_BRANCH_Z = 0xB0, + G_TRI2 = 0xB1, + G_MODIFYVTX = 0xB2, + G_RDPHALF_2 = 0xB3, + G_RDPHALF_1 = 0xB4, + G_QUAD = 0xB5, + G_CLEARGEOMETRYMODE = 0xB6, + G_SETGEOMETRYMODE = 0xB7, + G_ENDDL = 0xB8, + G_SETOTHERMODE_L = 0xB9, + G_SETOTHERMODE_H = 0xBA, + G_TEXTURE = 0xBB, + G_MOVEWORD = 0xBC, + G_POPMTX = 0xBD, + G_CULLDL = 0xBE, + G_TRI1 = 0xBF, + G_NOOP = 0xC0, + G_TEXRECT = 0xE4, + G_TEXRECTFLIP = 0xE5, + G_RDPLOADSYNC = 0xE6, + G_RDPPIPESYNC = 0xE7, + G_RDPTILESYNC = 0xE8, + G_RDPFULLSYNC = 0xE9, + G_SETKEYGB = 0xEA, + G_SETKEYR = 0xEB, + G_SETCONVERT = 0xEC, + G_SETSCISSOR = 0xED, + G_SETPRIMDEPTH = 0xEE, + G_RDPSETOTHERMODE = 0xEF, + G_LOADTLUT = 0xF0, + G_SETTILESIZE = 0xF2, + G_LOADBLOCK = 0xF3, + G_LOADTILE = 0xF4, + G_SETTILE = 0xF5, + G_FILLRECT = 0xF6, + G_SETFILLCOLOR = 0xF7, + G_SETFOGCOLOR = 0xF8, + G_SETBLENDCOLOR = 0xF9, + G_SETPRIMCOLOR = 0xFA, + G_SETENVCOLOR = 0xFB, + G_SETCOMBINE = 0xFC, + G_SETTIMG = 0xFD, + G_SETZIMG = 0xFE, + G_SETCIMG = 0xFF +}; + enum class F3DZEXOpcode { G_NOOP = 0x00, @@ -83,6 +137,12 @@ enum class F3DZEXTexSizes G_IM_SIZ_32b }; +enum class DListType +{ + F3DZEX, + F3DEX, +}; + enum class OoTSegments { DirectReference = 0, @@ -223,16 +283,44 @@ protected: static TextureType TexFormatToTexType(F3DZEXTexFormats fmt, F3DZEXTexSizes siz); void ParseRawData(); + void ParseF3DZEX(F3DZEXOpcode opcode, uint64_t data, int i, std::string prefix, char* line); + void ParseF3DEX(F3DEXOpcode opcode, uint64_t data, int i, std::string prefix, char* line); + // Various Instruction Optimizations bool SequenceCheck(std::vector<F3DZEXOpcode> sequence, int startIndex); int OptimizationChecks(int startIndex, std::string& output, std::string prefix); int OptimizationCheck_LoadTextureBlock(int startIndex, std::string& output, std::string prefix); int OptimizationCheck_LoadMultiBlock(int startIndex, std::string& output, std::string prefix); + + // F3DEX Specific Opcode Values + void Opcode_F3DEX_G_SETOTHERMODE_L(uint64_t data, int i, std::string prefix, char* line); + + // Shared Opcodes between F3DZEX and F3DEX + void Opcode_G_DL(uint64_t data, int i, std::string prefix, char* line); + void Opcode_G_MODIFYVTX(uint64_t data, int i, std::string prefix, char* line); + void Opcode_G_CULLDL(uint64_t data, int i, std::string prefix, char* line); + void Opcode_G_TRI1(uint64_t data, int i, std::string prefix, char* line); + void Opcode_G_TRI2(uint64_t data, int i, std::string prefix, char* line); + void Opcode_G_MTX(uint64_t data, int i, std::string prefix, char* line); + void Opcode_G_VTX(uint64_t data, int i, std::string prefix, char* line); + void Opcode_G_TEXTURE(uint64_t data, int i, std::string prefix, char* line); + void Opcode_G_SETTIMG(uint64_t data, int i, std::string prefix, char* line); + void Opcode_G_SETTILE(uint64_t data, int i, std::string prefix, char* line); + void Opcode_G_SETTILESIZE(uint64_t data, int i, std::string prefix, char* line); + void Opcode_G_LOADBLOCK(uint64_t data, int i, std::string prefix, char* line); + void Opcode_G_SETCOMBINE(uint64_t data, int i, std::string prefix, char* line); + void Opcode_G_SETPRIMCOLOR(uint64_t data, int i, std::string prefix, char* line); + void Opcode_G_SETOTHERMODE_L(uint64_t data, int i, std::string prefix, char* line); + void Opcode_G_SETOTHERMODE_H(uint64_t data, int i, std::string prefix, char* line); + void Opcode_G_LOADTLUT(uint64_t data, int i, std::string prefix, char* line); + void Opcode_G_ENDDL(uint64_t data, int i, std::string prefix, char* line); public: std::string sceneSegName; ZRoom* scene; std::vector<uint64_t> instructions; + DListType dListType; + //int dListAddress; std::map<uint32_t, std::vector<Vertex>> vertices; @@ -255,7 +343,7 @@ public: void TextureGenCheck(std::string prefix); static bool TextureGenCheck(std::vector<uint8_t> fileData, std::map<uint32_t, ZTexture*>& textures, ZRoom* scene, ZFile* parent, std::string prefix, uint32_t texWidth, uint32_t texHeight, uint32_t texAddr, uint32_t texSeg, F3DZEXTexFormats texFmt, F3DZEXTexSizes texSiz, bool texLoaded, bool texIsPalette); - static int GetDListLength(std::vector<uint8_t> rawData, int rawDataIndex); + static int GetDListLength(std::vector<uint8_t> rawData, int rawDataIndex, DListType dListType); std::vector<uint8_t> GetRawData(); int GetRawDataSize() override; |
