diff --git a/decompiler/ObjectFile/LinkedObjectFile.cpp b/decompiler/ObjectFile/LinkedObjectFile.cpp index 31439454d..85bae69fd 100644 --- a/decompiler/ObjectFile/LinkedObjectFile.cpp +++ b/decompiler/ObjectFile/LinkedObjectFile.cpp @@ -495,6 +495,11 @@ void LinkedObjectFile::process_fp_relative_links() { case InstructionKind::DADDU: case InstructionKind::ADDU: { assert(prev_instr); + if (prev_instr->kind != InstructionKind::ORI) { + lg::error("Failed to process fp relative links for (d)addu preceded by: {}", + prev_instr->to_string(labels)); + return; + } assert(prev_instr->kind == InstructionKind::ORI); int offset_reg_src_id = instr.kind == InstructionKind::DADDU ? 0 : 1; auto offset_reg = instr.get_src(offset_reg_src_id).get_reg(); @@ -814,7 +819,9 @@ std::string LinkedObjectFile::get_goal_string(int seg, int word_idx, bool with_q char cword[4]; memcpy(cword, &word.data, 4); result += cword[byte_offset]; - assert(result.back() != 0); + if (result.back() == 0) { + return "invalid string! (check me!)"; + } } if (with_quotes) { result += "\""; diff --git a/decompiler/ObjectFile/LinkedObjectFileCreation.cpp b/decompiler/ObjectFile/LinkedObjectFileCreation.cpp index ce5bfdfd5..a5f4d1536 100644 --- a/decompiler/ObjectFile/LinkedObjectFileCreation.cpp +++ b/decompiler/ObjectFile/LinkedObjectFileCreation.cpp @@ -302,7 +302,7 @@ static void link_v2_or_v4(LinkedObjectFile& f, for (uint8_t i = 0; i < count; i++) { if (!f.pointer_link_word(0, code_ptr_offset - code_offset, 0, *((const uint32_t*)(&data.at(code_ptr_offset))))) { - printf("WARNING bad link in %s\n", name.c_str()); + lg::error("Skipping link in {} because it is out of range!", name.c_str()); } f.stats.total_v2_pointers++; code_ptr_offset += 4; diff --git a/decompiler/ObjectFile/ObjectFileDB.cpp b/decompiler/ObjectFile/ObjectFileDB.cpp index a84264f52..f1fbfcbac 100644 --- a/decompiler/ObjectFile/ObjectFileDB.cpp +++ b/decompiler/ObjectFile/ObjectFileDB.cpp @@ -18,7 +18,6 @@ #include "decompiler/data/game_count.h" #include "LinkedObjectFileCreation.h" #include "decompiler/config.h" -#include "third-party/lzokay/lzokay.hpp" #include "common/util/BinaryReader.h" #include "common/util/Timer.h" #include "common/util/FileUtil.h" @@ -343,8 +342,11 @@ std::string ObjectFileDB::generate_dgo_listing() { namespace { std::string pad_string(const std::string& in, size_t length) { - assert(in.length() < length); - return in + std::string(length - in.length(), ' '); + if (in.length() < length) { + return in + std::string(length - in.length(), ' '); + } else { + return in; + } } } // namespace @@ -366,11 +368,16 @@ std::string ObjectFileDB::generate_obj_listing() { pad_string(x.name_in_dgo + "\", ", 50) + std::to_string(x.obj_version) + ", " + dgos + ", \"\"],\n"; unique_count++; + if (all_unique_names.find(x.to_unique_name()) != all_unique_names.end()) { + lg::error("Object file {} appears multiple times with the same name.", x.to_unique_name()); + } all_unique_names.insert(x.to_unique_name()); } // this check is extremely important. It makes sure we don't have any repeat names. This could // be caused by two files with the same name, in the same DGOs, but different data. - assert(int(all_unique_names.size()) == unique_count); + if (int(all_unique_names.size()) != unique_count) { + lg::error("Object files are not named properly, data will be lost!"); + } } if (result.length() >= 2) { diff --git a/decompiler/config/jak2/label_types.jsonc b/decompiler/config/jak2/label_types.jsonc new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/decompiler/config/jak2/label_types.jsonc @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/decompiler/config/jak2/var_names.jsonc b/decompiler/config/jak2/var_names.jsonc new file mode 100644 index 000000000..9e26dfeeb --- /dev/null +++ b/decompiler/config/jak2/var_names.jsonc @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/decompiler/config/jak2_ntsc_v1.jsonc b/decompiler/config/jak2_ntsc_v1.jsonc index f02bdbe0f..ced7094c3 100644 --- a/decompiler/config/jak2_ntsc_v1.jsonc +++ b/decompiler/config/jak2_ntsc_v1.jsonc @@ -1,32 +1,188 @@ { "game_version":2, - "dgo_names":["CGO/COMMON.CGO"], + "dgo_names":["CGO/ART.CGO", +"CGO/KERNEL.CGO", +"CGO/ENGINE.CGO", +"CGO/GAME.CGO", +"CGO/COMMON.CGO", +"DGO/LWIDEB.DGO", +"DGO/LMEETBRT.DGO", +"DGO/CTA.DGO", +"DGO/PALOUT.DGO", +"DGO/STD.DGO", +"DGO/FOR.DGO", +"DGO/CASEXT.DGO", +"DGO/HIDEOUT.DGO", +"DGO/LWIDESTA.DGO", +"DGO/LRACELIT.DGO", +"DGO/CTB.DGO", +"DGO/KIOSK.DGO", +"DGO/DG1.DGO", +"DGO/FEB.DGO", +"DGO/DMI.DGO", +"DGO/ORACLE.DGO", +"DGO/LERLTESS.DGO", +"DGO/DRI.DGO", +"DGO/LBRNERMK.DGO", +"DGO/LRACECF.DGO", +"DGO/CTC.DGO", +"DGO/LTHRNOUT.DGO", +"DGO/FRA.DGO", +"DGO/LGARCSTA.DGO", +"DGO/MTN.DGO", +"DGO/INTROCST.DGO", +"DGO/DRB.DGO", +"DGO/ATE.DGO", +"DGO/LERROL.DGO", +"DGO/LTRNYSAM.DGO", +"DGO/LOUTCSTB.DGO", +"DGO/LASHTHRN.DGO", +"DGO/TOC.DGO", +"DGO/CFB.DGO", +"DGO/CAB.DGO", +"DGO/STC.DGO", +"DGO/STR.DGO", +"DGO/ATO.DGO", +"DGO/SEB.DGO", +"DGO/LPRSNCST.DGO", +"DGO/SWB.DGO", +"DGO/LPOWER.DGO", +"DGO/FOB.DGO", +"DGO/CIB.DGO", +"DGO/LSHUTTLE.DGO", +"DGO/LJAKDAX.DGO", +"DGO/FORDUMPC.DGO", +"DGO/LTRNTESS.DGO", +"DGO/TBO.DGO", +"DGO/THR.DGO", +"DGO/PRI.DGO", +"DGO/LKIDDOGE.DGO", +"DGO/NESTT.DGO", +"DGO/LWIDEC.DGO", +"DGO/SAG.DGO", +"DGO/NEB.DGO", +"DGO/COB.DGO", +"DGO/LBOMBBOT.DGO", +"DGO/DEMO.DGO", +"DGO/LRACEDF.DGO", +"DGO/LERLCHAL.DGO", +"DGO/LHIPOUT.DGO", +"DGO/OUTROCST.DGO", +"DGO/NES.DGO", +"DGO/PAR.DGO", +"DGO/LERBRNGD.DGO", +"DGO/MTX.DGO", +"DGO/FDA.DGO", +"DGO/LKEIRIFT.DGO", +"DGO/LWHACK.DGO", +"DGO/LJKDXASH.DGO", +"DGO/CAS.DGO", +"DGO/COA.DGO", +"DGO/LTESS.DGO", +"DGO/CFA.DGO", +"DGO/TOMBEXT.DGO", +"DGO/LCGUARD.DGO", +"DGO/TOE.DGO", +"DGO/PALBOSS.DGO", +"DGO/FRB.DGO", +"DGO/PAE.DGO", +"DGO/TITLE.DGO", +"DGO/FORDUMPD.DGO", +"DGO/D3A.DGO", +"DGO/DRILLMTN.DGO", +"DGO/PAC.DGO", +"DGO/LTENTOB.DGO", +"DGO/LRACEBF.DGO", +"DGO/LPROTECT.DGO", +"DGO/FEA.DGO", +"DGO/ONINTENT.DGO", +"DGO/STA.DGO", +"DGO/CGC.DGO", +"DGO/CMA.DGO", +"DGO/FDB.DGO", +"DGO/SKA.DGO", +"DGO/LTRNKRKD.DGO", +"DGO/CIA.DGO", +"DGO/TOB.DGO", +"DGO/LRACEDB.DGO", +"DGO/LDJAKBRN.DGO", +"DGO/TOA.DGO", +"DGO/STADBLMP.DGO", +"DGO/UND.DGO", +"DGO/LYSKDCD.DGO", +"DGO/HALFPIPE.DGO", +"DGO/LSAMERGD.DGO", +"DGO/PAS.DGO", +"DGO/LBBUSH.DGO", +"DGO/LPACKAGE.DGO", +"DGO/LINTCSTB.DGO", +"DGO/LPORTRUN.DGO", +"DGO/LASHGRD.DGO", +"DGO/CGB.DGO", +"DGO/D3B.DGO", +"DGO/STB.DGO", +"DGO/GARAGE.DGO", +"DGO/PORTWALL.DGO", +"DGO/LHELLDOG.DGO", +"DGO/SWE.DGO", +"DGO/LRACECB.DGO", +"DGO/GGA.DGO", +"DGO/TOD.DGO", +"DGO/MCN.DGO", +"DGO/SEW.DGO", +"DGO/VIN.DGO", +"DGO/CGA.DGO", +"DGO/CMB.DGO", +"DGO/LGUARD.DGO", +"DGO/CPA.DGO", +"DGO/LCITYLOW.DGO", +"DGO/LTENTOUT.DGO", +"DGO/UNB.DGO", +"DGO/CPO.DGO", +"DGO/CAP.DGO", +"DGO/CWI.DGO", +"DGO/CTYKORA.DGO", +"DGO/RUI.DGO", +"DGO/LSACK.DGO", +"DGO/CTYASHA.DGO", +"DGO/LPRTRACE.DGO", +"DGO/LWIDEA.DGO", +"DGO/HIPHOG.DGO", +"DGO/LSMYSBRT.DGO", +"DGO/LRACEBB.DGO", +"DGO/CASCITY.DGO", +"DGO/LYSAMSAM.DGO", +"DGO/VI1.DGO" +], "object_file_names":[], "type_hints_file":"decompiler/config/jak2/type_hints.jsonc", "anonymous_function_types_file":"decompiler/config/jak2/anonymous_function_types.jsonc", + "var_names_file":"decompiler/config/jak2/var_names.jsonc", + "label_types_file":"decompiler/config/jak2/label_types.jsonc", "str_file_names":[], "str_file_names_":[], "allowed_objects":[], - "analyze_functions":true, + "analyze_functions":false, "analyze_expressions":false, - "function_type_prop":true, + "function_type_prop":false, "write_disassembly":true, "write_hex_near_instructions":false, + "insert_lets":false, - "run_ir2":true, + "run_ir2":false, // if false, skips printing disassembly of object with functions, as these are usually large (~1 GB) and not interesting yet. "disassemble_objects_without_functions":false, - "process_tpages":true, - "process_game_text":true, - "process_game_count":true, + "process_tpages":false, + "process_game_text":false, + "process_game_count":false, "dump_objs":true, "write_func_json":false, @@ -36,9 +192,7 @@ "write_hexdump_on_v3_only":true, // to write out "scripts", which are currently just all the linked lists found. mostly a jak 2/3 thing - "write_scripts":false, - - + "write_scripts":true, // Experimental Stuff "find_basic_blocks":true, diff --git a/decompiler/config/jak3_ntsc.jsonc b/decompiler/config/jak3_ntsc.jsonc index df4629f7e..a9dc87961 100644 --- a/decompiler/config/jak3_ntsc.jsonc +++ b/decompiler/config/jak3_ntsc.jsonc @@ -1,56 +1,326 @@ { "game_version":3, - "dgo_names":["ARENACST.DGO", "ART.CGO", "CFA.DGO", "CFB.DGO", "CGB.DGO", "CIA.DGO", "CIB.DGO", "CITYCAST.DGO", - "COMBA.DGO", "COMBB.DGO", "COMBC.DGO", "COMBD.DGO", "COMBE.DGO", "COMBN.DGO", "COMBX.DGO", "COMMON.CGO", - "CPO.DGO", "CTA.DGO", "CTB.DGO", "CTC.DGO", "CTYCARA.DGO", "CTYCARB.DGO", "CTYCARC.DGO", "CTYCARKG.DGO", - "CTYPEPA.DGO", "CTYPEPB.DGO", "CTYPEPC.DGO", "CTYPESA.DGO", "CTYPESB.DGO", "CTYPESC.DGO", "CWI.DGO", "DESA.DGO", - "DESB.DGO", "DESBATTL.DGO", "DESBCST.DGO", "DESBOSS1.DGO", "DESBOSS2.DGO", "DESC.DGO", "DESCHASE.DGO", "DESD.DGO", - "DESE.DGO", "DESERROL.DGO", "DESF.DGO", "DESG.DGO", "DESH.DGO", "DESHOVER.DGO", "DESHUNT.DGO", "DESINTER.DGO", - "DESJUMP.DGO", "DESLIZ.DGO", "DESOASIS.DGO", "DESRACE1.DGO", "DESRACE2.DGO", "DESRALLY.DGO", "DESRESC.DGO", "DESRESCC.DGO", - "DESRESCG.DGO", "DESTRACK.DGO", "DESW.DGO", "DST.DGO", "ENGINE.CGO", "FACB.DGO", "FACC.DGO", "FACD.DGO", - "FACTORYA.DGO", "FREECAST.DGO", "FREEHQ.DGO", "FRSTA.DGO", "FRSTB.DGO", "FRSTX.DGO", "GAME.CGO", "GGA.DGO", - "GRIDCST.DGO", "GUNGAME1.DGO", "GUNGAME2.DGO", "HALFPIPE.DGO", "HGA.DGO", "HGB.DGO", "HHG.DGO", "INTPALRF.DGO", - "INTROCST.DGO", "INTTITLE.DGO", "IPF.DGO", "KERNEL.CGO", "LASHELIN.DGO", "LBBRING1.DGO", "LBBRING2.DGO", "LBBRING3.DGO", - "LBBRING4.DGO", "LBBRING5.DGO", "LBBRING6.DGO", "LBBSDRP1.DGO", "LBBSDRP2.DGO", "LBBSDRP3.DGO", "LBBSPID.DGO", "LBBSPIRT.DGO", - "LBBSPRT2.DGO", "LBBSPRT3.DGO", "LBBTCHA1.DGO", "LBBTCHA2.DGO", "LBBTCHA3.DGO", "LBIPED.DGO", "LBLOWCST.DGO", "LBLOWTKG.DGO", - "LBLOWTMH.DGO", "LBOMBBOT.DGO", "LCITYSML.DGO", "LCTYASS.DGO", "LCTYBLOW.DGO", "LCTYDEST.DGO", "LCTYHIJK.DGO", "LCTYPALT.DGO", - "LCTYPATK.DGO", "LCTYPROT.DGO", "LCTYSNPR.DGO", "LDAMKLEV.DGO", "LDAMPECK.DGO", "LDAMPKSM.DGO", "LDAMSIG.DGO", "LDAX.DGO", - "LDESGCST.DGO", "LDMPCKGN.DGO", "LERROL.DGO", "LFACB.DGO", "LFACCAR.DGO", "LFACCITY.DGO", "LFACO.DGO", "LFACRM1.DGO", - "LFACRM2.DGO", "LFACTORY.DGO", "LFORM.DGO", "LFORP.DGO", "LFORRING.DGO", "LFREEOUT.DGO", "LGUNNORM.DGO", "LGUNRNC.DGO", - "LJAK.DGO", "LJAKC.DGO", "LJAKCKLV.DGO", "LJAKKLEV.DGO", "LJAKNDAX.DGO", "LJAKSIG.DGO", "LJINX.DGO", "LJKCDMKL.DGO", - "LJKDMPK.DGO", "LJKDXVIN.DGO", "LJKFEET.DGO", "LJNDKLEV.DGO", "LKEIRA.DGO", "LKLEEVER.DGO", "LMECH.DGO", "LMHCA.DGO", - "LMHCB.DGO", "LNSTCST.DGO", "LNSTOA.DGO", "LNSTOBB.DGO", "LNSTOBC.DGO", "LONINSIM.DGO", "LOUTRO.DGO", "LOUTRO2.DGO", - "LOUTRO3.DGO", "LPATK.DGO", "LPATKCS.DGO", "LPRECC.DGO", "LPRENME.DGO", "LPTRL.DGO", "LSAMOS.DGO", "LSEEMWCA.DGO", - "LSIG.DGO", "LSIGJAKC.DGO", "LSIGKLV.DGO", "LSNKWHLS.DGO", "LTNFXHIP.DGO", "LTNJXHIP.DGO", "LTORN.DGO", "LTORNJNX.DGO", - "LTORNSAM.DGO", "LTOWA.DGO", "LTOWB.DGO", "LTOWCITY.DGO", "LTRTWHLS.DGO", "LVINCST.DGO", "LWASBBV.DGO", "LWASSIG.DGO", - "LWLANDM.DGO", "LWSTDPCK.DGO", "MHCA.DGO", "MHCB.DGO", "MHCTYCST.DGO", "MIA.DGO", "MIB.DGO", "MIC.DGO", - "MINED.DGO", "MINEE.DGO", "MUSEUM.DGO", "MUSEUM2.DGO", "MUSEUM3.DGO", "MUSEUM3B.DGO", "MUSEUM4.DGO", "MUSEUM4B.DGO", - "NSA.DGO", "NSB.DGO", "OASISCST.DGO", "ONINTENT.DGO", "OUTCAST3.DGO", "OUTROCST.DGO", "POWERGD.DGO", "PRECA.DGO", - "PRECB.DGO", "PRECC.DGO", "PRECD.DGO", "RAILA.DGO", "RAILB.DGO", "RAILB2.DGO", "RAILC.DGO", "RAILCST.DGO", - "RAILD.DGO", "RAILE.DGO", "RAILF.DGO", "RAILX.DGO", "RBCT.DGO", "RUBA.DGO", "RUBA2.DGO", "RUBB.DGO", - "RUBC.DGO", "SEA.DGO", "SEB.DGO", "SEC.DGO", "SED.DGO", "SEE.DGO", "SEF.DGO", "SEG.DGO", - "SEH.DGO", "SEI.DGO", "SEJ.DGO", "SEK.DGO", "SEL.DGO", "SEM.DGO", "SEN.DGO", "SEO.DGO", - "SLUMBSET.DGO", "STA.DGO", "STAA.DGO", "STB.DGO", "TEMA.DGO", "TEMB.DGO", "TEMC.DGO", "TEMD.DGO", - "TEMP.DGO", "TEMPLEE.DGO", "TEMX.DGO", "TITLE.DGO", "TOWB.DGO", "TOWERA.DGO", "TOWERC.DGO", "TOWERCST.DGO", - "VIN.DGO", "VOCA.DGO", "VOCX.DGO", "WARPCAST.DGO", "WASALL.DGO", "WASCAST.DGO", "WASCHASE.DGO", "WASDEFEN.DGO", - "WASLEAPR.DGO", "WASPALA.DGO", "WASPGAME.DGO", "WASSEEM.DGO", "WASSTADA.DGO", "WASSTADB.DGO", "WASSTADC.DGO", "WCA.DGO", - "WCASEEM.DGO", "WCB.DGO", "WIN.DGO", "WSD.DGO", "WWD.DGO"], + "dgo_names":["CGO/ART.CGO", +"CGO/KERNEL.CGO", +"CGO/ENGINE.CGO", +"CGO/GAME.CGO", +"CGO/COMMON.CGO", +"DGO/LJKDMPK.DGO", +"DGO/LBBSDRP1.DGO", +"DGO/LTNJXHIP.DGO", +"DGO/MIC.DGO", +"DGO/OASISCST.DGO", +"DGO/CTYPEPA.DGO", +"DGO/LPRENME.DGO", +"DGO/LFREEOUT.DGO", +"DGO/LGUNNORM.DGO", +"DGO/LTOWA.DGO", +"DGO/TEMA.DGO", +"DGO/CTA.DGO", +"DGO/LPRECC.DGO", +"DGO/LJKDXVIN.DGO", +"DGO/CTYPEPC.DGO", +"DGO/SEA.DGO", +"DGO/COMBE.DGO", +"DGO/CTYPESA.DGO", +"DGO/LBLOWCST.DGO", +"DGO/WSD.DGO", +"DGO/LBBRING3.DGO", +"DGO/LCTYPATK.DGO", +"DGO/WCB.DGO", +"DGO/DESRESC.DGO", +"DGO/LBBRING4.DGO", +"DGO/GRIDCST.DGO", +"DGO/RAILX.DGO", +"DGO/SEJ.DGO", +"DGO/LJAKC.DGO", +"DGO/CTB.DGO", +"DGO/CTYCARC.DGO", +"DGO/LMECH.DGO", +"DGO/LBBSDRP2.DGO", +"DGO/NSA.DGO", +"DGO/LBBTCHA3.DGO", +"DGO/GUNGAME2.DGO", +"DGO/CTC.DGO", +"DGO/LVINCST.DGO", +"DGO/COMBX.DGO", +"DGO/DESH.DGO", +"DGO/DESRACE2.DGO", +"DGO/RAILD.DGO", +"DGO/FACC.DGO", +"DGO/CTYPESC.DGO", +"DGO/LWASBBV.DGO", +"DGO/TOWB.DGO", +"DGO/HGA.DGO", +"DGO/SEH.DGO", +"DGO/MHCTYCST.DGO", +"DGO/GUNGAME1.DGO", +"DGO/INTROCST.DGO", +"DGO/DESJUMP.DGO", +"DGO/SEM.DGO", +"DGO/SEI.DGO", +"DGO/DESG.DGO", +"DGO/DESW.DGO", +"DGO/LOUTRO3.DGO", +"DGO/LDAMKLEV.DGO", +"DGO/DESERROL.DGO", +"DGO/RAILB2.DGO", +"DGO/LERROL.DGO", +"DGO/IPF.DGO", +"DGO/RAILB.DGO", +"DGO/LCTYHIJK.DGO", +"DGO/CTYPEPB.DGO", +"DGO/PRECB.DGO", +"DGO/LFORM.DGO", +"DGO/WASLEAPR.DGO", +"DGO/LKEIRA.DGO", +"DGO/LJAK.DGO", +"DGO/SLUMBSET.DGO", +"DGO/FACD.DGO", +"DGO/LWASSIG.DGO", +"DGO/LBIPED.DGO", +"DGO/DESD.DGO", +"DGO/CFB.DGO", +"DGO/FREECAST.DGO", +"DGO/SEG.DGO", +"DGO/FACTORYA.DGO", +"DGO/LPATK.DGO", +"DGO/FRSTX.DGO", +"DGO/SEB.DGO", +"DGO/DESBCST.DGO", +"DGO/DESE.DGO", +"DGO/DESOASIS.DGO", +"DGO/CTYCARA.DGO", +"DGO/LSIGKLV.DGO", +"DGO/CIB.DGO", +"DGO/LBBRING2.DGO", +"DGO/LTNFXHIP.DGO", +"DGO/MIA.DGO", +"DGO/MHCB.DGO", +"DGO/LNSTOBC.DGO", +"DGO/COMBD.DGO", +"DGO/RBCT.DGO", +"DGO/LTORNJNX.DGO", +"DGO/DESBATTL.DGO", +"DGO/SEK.DGO", +"DGO/LSNKWHLS.DGO", +"DGO/LMHCB.DGO", +"DGO/LBOMBBOT.DGO", +"DGO/OUTCAST3.DGO", +"DGO/LBLOWTMH.DGO", +"DGO/TEMD.DGO", +"DGO/LTOWCITY.DGO", +"DGO/OUTROCST.DGO", +"DGO/WASCAST.DGO", +"DGO/LFACRM2.DGO", +"DGO/WASPGAME.DGO", +"DGO/RAILE.DGO", +"DGO/CTYPESB.DGO", +"DGO/DESBOSS1.DGO", +"DGO/FREEHQ.DGO", +"DGO/LTORN.DGO", +"DGO/TOWERA.DGO", +"DGO/LSAMOS.DGO", +"DGO/LFORP.DGO", +"DGO/CFA.DGO", +"DGO/LJINX.DGO", +"DGO/SEO.DGO", +"DGO/PRECA.DGO", +"DGO/TOWERC.DGO", +"DGO/WCA.DGO", +"DGO/SEC.DGO", +"DGO/DESF.DGO", +"DGO/SEL.DGO", +"DGO/LCTYDEST.DGO", +"DGO/LTORNSAM.DGO", +"DGO/MUSEUM3B.DGO", +"DGO/SEE.DGO", +"DGO/DESHUNT.DGO", +"DGO/RAILA.DGO", +"DGO/TITLE.DGO", +"DGO/RUBC.DGO", +"DGO/DESB.DGO", +"DGO/LFACCAR.DGO", +"DGO/LNSTOA.DGO", +"DGO/MUSEUM3.DGO", +"DGO/ONINTENT.DGO", +"DGO/STA.DGO", +"DGO/WASSTADA.DGO", +"DGO/POWERGD.DGO", +"DGO/LKLEEVER.DGO", +"DGO/FACB.DGO", +"DGO/LCTYASS.DGO", +"DGO/MHCA.DGO", +"DGO/LTOWB.DGO", +"DGO/LNSTCST.DGO", +"DGO/DESRESCG.DGO", +"DGO/INTPALRF.DGO", +"DGO/LMHCA.DGO", +"DGO/TOWERCST.DGO", +"DGO/RAILF.DGO", +"DGO/CIA.DGO", +"DGO/CTYCARKG.DGO", +"DGO/WASCHASE.DGO", +"DGO/LFACO.DGO", +"DGO/WIN.DGO", +"DGO/TEMPLEE.DGO", +"DGO/LBBSPIRT.DGO", +"DGO/MUSEUM2.DGO", +"DGO/INTTITLE.DGO", +"DGO/STAA.DGO", +"DGO/MUSEUM4B.DGO", +"DGO/PRECD.DGO", +"DGO/SEF.DGO", +"DGO/CTYCARB.DGO", +"DGO/WASDEFEN.DGO", +"DGO/LBLOWTKG.DGO", +"DGO/DESA.DGO", +"DGO/COMBB.DGO", +"DGO/WASSTADC.DGO", +"DGO/DESC.DGO", +"DGO/LDAMPECK.DGO", +"DGO/LJAKSIG.DGO", +"DGO/HALFPIPE.DGO", +"DGO/DESRACE1.DGO", +"DGO/SEN.DGO", +"DGO/TEMP.DGO", +"DGO/SED.DGO", +"DGO/LFACB.DGO", +"DGO/LCTYSNPR.DGO", +"DGO/LBBSPID.DGO", +"DGO/FRSTA.DGO", +"DGO/LBBRING5.DGO", +"DGO/LBBSPRT3.DGO", +"DGO/HHG.DGO", +"DGO/LBBSPRT2.DGO", +"DGO/CGB.DGO", +"DGO/LDMPCKGN.DGO", +"DGO/LSEEMWCA.DGO", +"DGO/HGB.DGO", +"DGO/LONINSIM.DGO", +"DGO/RUBA.DGO", +"DGO/DESRALLY.DGO", +"DGO/WWD.DGO", +"DGO/STB.DGO", +"DGO/MIB.DGO", +"DGO/LCTYBLOW.DGO", +"DGO/LWSTDPCK.DGO", +"DGO/MUSEUM.DGO", +"DGO/LJAKCKLV.DGO", +"DGO/LBBRING1.DGO", +"DGO/MUSEUM4.DGO", +"DGO/LFACRM1.DGO", +"DGO/LJKCDMKL.DGO", +"DGO/LDAMSIG.DGO", +"DGO/DESTRACK.DGO", +"DGO/GGA.DGO", +"DGO/RAILC.DGO", +"DGO/LBBTCHA2.DGO", +"DGO/DESINTER.DGO", +"DGO/NSB.DGO", +"DGO/LOUTRO.DGO", +"DGO/VIN.DGO", +"DGO/LDESGCST.DGO", +"DGO/WARPCAST.DGO", +"DGO/LBBRING6.DGO", +"DGO/FRSTB.DGO", +"DGO/TEMC.DGO", +"DGO/COMBC.DGO", +"DGO/LTRTWHLS.DGO", +"DGO/PRECC.DGO", +"DGO/DESCHASE.DGO", +"DGO/CITYCAST.DGO", +"DGO/CPO.DGO", +"DGO/LFACCITY.DGO", +"DGO/RAILCST.DGO", +"DGO/LJNDKLEV.DGO", +"DGO/CWI.DGO", +"DGO/MINEE.DGO", +"DGO/LFORRING.DGO", +"DGO/LASHELIN.DGO", +"DGO/LJAKKLEV.DGO", +"DGO/LCTYPALT.DGO", +"DGO/LNSTOBB.DGO", +"DGO/LJKFEET.DGO", +"DGO/DST.DGO", +"DGO/LBBTCHA1.DGO", +"DGO/LGUNRNC.DGO", +"DGO/COMBN.DGO", +"DGO/DESRESCC.DGO", +"DGO/LSIGJAKC.DGO", +"DGO/DESLIZ.DGO", +"DGO/WASPALA.DGO", +"DGO/LJAKNDAX.DGO", +"DGO/WASSEEM.DGO", +"DGO/WASALL.DGO", +"DGO/WCASEEM.DGO", +"DGO/LSIG.DGO", +"DGO/LFACTORY.DGO", +"DGO/LWLANDM.DGO", +"DGO/LPTRL.DGO", +"DGO/MINED.DGO", +"DGO/LDAMPKSM.DGO", +"DGO/RUBB.DGO", +"DGO/LCITYSML.DGO", +"DGO/RUBA2.DGO", +"DGO/LOUTRO2.DGO", +"DGO/VOCX.DGO", +"DGO/TEMX.DGO", +"DGO/ARENACST.DGO", +"DGO/TEMB.DGO", +"DGO/COMBA.DGO", +"DGO/LBBSDRP3.DGO", +"DGO/LPATKCS.DGO", +"DGO/VOCA.DGO", +"DGO/WASSTADB.DGO", +"DGO/LDAX.DGO", +"DGO/LCTYPROT.DGO", +"DGO/DESHOVER.DGO", +"DGO/DESBOSS2.DGO"], - // to write out disassembled functions in .func files - "write_disassembly":true, - "write_hex_near_instructions":false, - // if false, skips disassembling object files without functions, as these are usually large and not interesting yet. - "disassemble_objects_without_functions":false, + "object_file_names":[], - // to write out data of each object file - "write_hexdump":false, - // to write out hexdump on the v3 only, to avoid the huge level data files - "write_hexdump_on_v3_only":true, + "type_hints_file":"decompiler/config/jak2/type_hints.jsonc", + "anonymous_function_types_file":"decompiler/config/jak2/anonymous_function_types.jsonc", + "var_names_file":"decompiler/config/jak2/var_names.jsonc", + "label_types_file":"decompiler/config/jak2/label_types.jsonc", - // to write out "scripts", which are currently just all the linked lists found - "write_scripts":true, + "str_file_names":[], + "str_file_names_":[], + "allowed_objects":[], + + "analyze_functions":false, + "analyze_expressions":false, + "function_type_prop":false, + "write_disassembly":true, + "write_hex_near_instructions":false, + "insert_lets":false, + + "run_ir2":false, + + // if false, skips printing disassembly of object with functions, as these are usually large (~1 GB) and not interesting yet. + "disassemble_objects_without_functions":false, + + "process_tpages":false, + "process_game_text":false, + "process_game_count":false, + "dump_objs":true, + "write_func_json":false, + + // to write out data of each object file + "write_hexdump":false, + // to write out hexdump on the v3 only, to avoid the huge level data files. Only if write_hexdump is true. + "write_hexdump_on_v3_only":true, + + // to write out "scripts", which are currently just all the linked lists found. mostly a jak 2/3 thing + "write_scripts":true, // Experimental Stuff - "find_basic_blocks":true + "find_basic_blocks":true, + + "types_with_bad_inspect_methods":[], + "no_type_analysis_functions_by_name":[], + "asm_functions_by_name":[], + "pair_functions_by_name":[] } \ No newline at end of file diff --git a/tools/dgo_packer.cpp b/tools/dgo_packer.cpp index a33f9e46f..3b282bdb1 100644 --- a/tools/dgo_packer.cpp +++ b/tools/dgo_packer.cpp @@ -31,14 +31,15 @@ int main(int argc, char** argv) { for (auto& entry : x["objects"]) { auto obj_data = file_util::read_binary_file(file_util::combine_path(out_path, entry["unique_name"])); + auto aligned_size = ((obj_data.size() + 15) / 16) * 16; // size - writer.add(obj_data.size()); + writer.add(aligned_size); // name writer.add_str_len(entry["internal_name"].get().c_str(), 60); // data writer.add_data(obj_data.data(), obj_data.size()); // pad - while (writer.get_size() & 0xf) { + while (writer.get_size() & 15) { writer.add(0); } }