mirror of
https://github.com/izzy2lost/Diddy-Kong-Racing.git
synced 2026-06-19 01:16:26 -07:00
Asset Revision 4
This commit is contained in:
@@ -12,16 +12,6 @@ VERSION := us_1.0
|
||||
NON_MATCHING ?= 0
|
||||
$(eval $(call validate-option,NON_MATCHING,0 1))
|
||||
|
||||
COMPILE_ASSETS ?= 0
|
||||
$(eval $(call validate-option,COMPILE_ASSETS,0 1))
|
||||
|
||||
ifeq ($(COMPILE_ASSETS),1)
|
||||
DUMMY != ./tools/dkr_assets_tool -c $(VERSION) ./assets >&2 || echo FAIL
|
||||
ifeq ($(DUMMY),FAIL)
|
||||
$(error Failed to compile assets)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(VERSION),us_1.0)
|
||||
DEFINES += VERSION_US_1_0=1
|
||||
DEFINES += F3DDKR_GBI=1
|
||||
@@ -100,6 +90,10 @@ endif
|
||||
|
||||
DUMMY != python3 ./tools/python/check_if_need_to_extract.py $(VERSION) >&2 || echo FAIL
|
||||
|
||||
######## Prebuild step (Compile assets, generate linker file, etc.) ########
|
||||
|
||||
DUMMY != ./tools/dkr_assets_tool -dkrv $(VERSION) prebuild >&2 || echo FAIL
|
||||
|
||||
################################
|
||||
|
||||
endif
|
||||
@@ -181,8 +175,7 @@ LOADER_FLAGS = -vwf
|
||||
|
||||
N64CRC = $(TOOLS_DIR)/n64crc
|
||||
FIXCHECKSUMS = python3 $(TOOLS_DIR)/python/calc_func_checksums.py $(VERSION)
|
||||
COMPRESS = $(TOOLS_DIR)/dkr_assets_tool -fc
|
||||
BUILDER = $(TOOLS_DIR)/dkr_assets_tool -b $(VERSION) ./assets
|
||||
BUILDER = $(TOOLS_DIR)/dkr_assets_tool -dkrv $(VERSION) build
|
||||
|
||||
LIB_DIRS := lib
|
||||
ASM_DIRS := asm asm/boot asm/assets lib/asm lib/asm/non_decompilable
|
||||
@@ -229,13 +222,12 @@ JSON_FILES := $(shell find $(ASSETS) -type f -name '*.json')
|
||||
IGNORE_JSON_FILES := $(shell find $(ASSETS) -type f -name '*.meta.json')
|
||||
JSON_FILES := $(filter-out $(IGNORE_JSON_FILES),$(JSON_FILES))
|
||||
# Add .cbin files
|
||||
CBIN_FILES := $(shell find $(ASSETS) -type f -name '*.cbin')
|
||||
#CBIN_FILES := $(shell find $(ASSETS) -type f -name '*.cbin')
|
||||
# Add .bin files
|
||||
BIN_FILES := $(shell find $(ASSETS) -type f -name '*.bin')
|
||||
ALL_FILES := $(CBIN_FILES) $(BIN_FILES) $(JSON_FILES)
|
||||
#BIN_FILES := $(shell find $(ASSETS) -type f -name '*.bin')
|
||||
ALL_FILES := $(JSON_FILES)
|
||||
|
||||
ALL_FILES_OUT := $(foreach FILE,ALL_FILES,$($(FILE):$(ASSETS)%=$(ASSETS_BUILD_DIR)%))
|
||||
ALL_FILES_OUT := $(foreach FILE,ALL_FILES_OUT,$($(FILE):$.cbin%=$.bin%))
|
||||
ALL_FILES_OUT := $(foreach FILE,ALL_FILES_OUT,$($(FILE):$.json%=$.bin%))
|
||||
|
||||
DIRECTORY = $(sort $(dir $(ALL_FILES_OUT))) $(addprefix $(BUILD_DIR)/,$(LIB_DIRS) $(ASM_DIRS) $(SRC_DIRS) ucode)
|
||||
@@ -250,22 +242,10 @@ $$(BASE_PATH).bin: $1
|
||||
$(eval ALL_ASSETS_BUILT+=$(BASE_PATH).bin)
|
||||
endef
|
||||
|
||||
# $1 = Print message
|
||||
define BIN_FILE_ACTION
|
||||
$$(call print,$1:,$$<,$$@)
|
||||
$$(V)$$(ASSETS_COPY) $$^ $$@
|
||||
endef
|
||||
|
||||
# $1 = Print message
|
||||
define CBIN_FILE_ACTION
|
||||
$$(call print,$1:,$$<,$$@)
|
||||
$$(V)$$(COMPRESS) $$^ $$@
|
||||
endef
|
||||
|
||||
# $1 = Print message
|
||||
define JSON_FILE_ACTION
|
||||
$$(call print,$1:,$$<,$$@)
|
||||
$$(V)$$(BUILDER) $$< $$@
|
||||
$$(V)$$(BUILDER) -i $$< -o $$@
|
||||
endef
|
||||
|
||||
# Microcode
|
||||
@@ -361,18 +341,6 @@ dont_remove_asset_files: $(ALL_ASSETS_BUILT)
|
||||
|
||||
######## Asset Targets ########
|
||||
|
||||
$(BUILD_DIR)/enumsCache.bin: include/enums.h
|
||||
$(call print,Building enums.h cache:,$<,$@)
|
||||
$(V)$(TOOLS_DIR)/dkr_assets_tool -bc $(VERSION) $<
|
||||
|
||||
dkr.ld: $(BUILD_DIR)/enumsCache.bin
|
||||
@$(PRINT) "$(YELLOW)Generating Linker File...$(NO_COL)\n"
|
||||
$(V)./generate_ld.sh $(VERSION)
|
||||
|
||||
ALL_ASSETS_BUILT += dkr.ld # This is a hack, but it works I guess.
|
||||
|
||||
$(foreach FILE,$(BIN_FILES),$(eval $(call DEFINE_ASSET_TARGET,$(FILE),$(call BIN_FILE_ACTION,Copying))))
|
||||
$(foreach FILE,$(CBIN_FILES),$(eval $(call DEFINE_ASSET_TARGET,$(FILE),$(call CBIN_FILE_ACTION,Compressing))))
|
||||
$(foreach FILE,$(JSON_FILES),$(eval $(call DEFINE_ASSET_TARGET,$(FILE),$(call JSON_FILE_ACTION,Building))))
|
||||
|
||||
# Microcode target
|
||||
|
||||
+1974
-1953
File diff suppressed because it is too large
Load Diff
@@ -1,14 +1,14 @@
|
||||
# This file was generated by generate_ld.py
|
||||
# This file is automatically generated. Any changes you make to this file will get overwritten.
|
||||
|
||||
.include "macros.inc"
|
||||
|
||||
glabel aspMainDataStart
|
||||
.incbin "./build/us_1.0/ucode/data_audio.bin"
|
||||
.incbin "build/us_1.0/ucode/data_audio.bin"
|
||||
glabel rspF3DDKRDataDramStart
|
||||
.incbin "./build/us_1.0/ucode/data_f3ddkr_dram.bin"
|
||||
.incbin "build/us_1.0/ucode/data_f3ddkr_dram.bin"
|
||||
glabel rspF3DDKRDataFifoStart
|
||||
.incbin "./build/us_1.0/ucode/data_f3ddkr_fifo.bin"
|
||||
.incbin "build/us_1.0/ucode/data_f3ddkr_fifo.bin"
|
||||
glabel rspF3DDKRDataXbusStart
|
||||
.incbin "./build/us_1.0/ucode/data_f3ddkr_xbus.bin"
|
||||
.incbin "build/us_1.0/ucode/data_f3ddkr_xbus.bin"
|
||||
glabel rspUnknown2DataStart
|
||||
.incbin "./build/us_1.0/ucode/data_unknown_2.bin"
|
||||
.incbin "build/us_1.0/ucode/data_unknown_2.bin"
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
# This file was generated by generate_ld.py
|
||||
# This file is automatically generated. Any changes you make to this file will get overwritten.
|
||||
|
||||
.include "macros.inc"
|
||||
|
||||
glabel aspMainTextStart
|
||||
.incbin "./build/us_1.0/ucode/ucode_audio.bin"
|
||||
.incbin "build/us_1.0/ucode/ucode_audio.bin"
|
||||
glabel rspF3DDKRBootStart
|
||||
.incbin "./build/us_1.0/ucode/ucode_boot.bin"
|
||||
.incbin "build/us_1.0/ucode/ucode_boot.bin"
|
||||
glabel rspF3DDKRDramStart
|
||||
.incbin "./build/us_1.0/ucode/ucode_f3ddkr_dram.bin"
|
||||
.incbin "build/us_1.0/ucode/ucode_f3ddkr_dram.bin"
|
||||
glabel rspF3DDKRFifoStart
|
||||
.incbin "./build/us_1.0/ucode/ucode_f3ddkr_fifo.bin"
|
||||
.incbin "build/us_1.0/ucode/ucode_f3ddkr_fifo.bin"
|
||||
glabel rspF3DDKRXbusStart
|
||||
.incbin "./build/us_1.0/ucode/ucode_f3ddkr_xbus.bin"
|
||||
.incbin "build/us_1.0/ucode/ucode_f3ddkr_xbus.bin"
|
||||
glabel rspUnknown2Start
|
||||
.incbin "./build/us_1.0/ucode/ucode_unknown_2.bin"
|
||||
.incbin "build/us_1.0/ucode/ucode_unknown_2.bin"
|
||||
|
||||
Binary file not shown.
+1
-1
@@ -1 +1 @@
|
||||
.incbin "./assets/us_1.0/bin/boot.bin"
|
||||
.incbin "asm/boot/boot.bin"
|
||||
|
||||
Executable → Regular
+546
-375
File diff suppressed because it is too large
Load Diff
+1
-4
@@ -21,10 +21,7 @@ if [ -d "$UCODE_DIR" ]; then
|
||||
rm -r $UCODE_DIR
|
||||
fi
|
||||
|
||||
if ! ./tools/dkr_assets_tool -bc "$VER" ./include/enums.h ; then
|
||||
exit 1
|
||||
fi
|
||||
if ! ./tools/dkr_assets_tool -e "$VER" ./assets ./extract-ver ./baseroms . ; then
|
||||
if ! ./tools/dkr_assets_tool -dkrv $VER extract ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -17,6 +17,20 @@ typedef enum SpecialMapId {
|
||||
SPECIAL_MAP_ID_NO_LEVEL = -1,
|
||||
} SpecialMapId;
|
||||
|
||||
typedef enum Character {
|
||||
CHARACTER_KRUNCH,
|
||||
CHARACTER_BUMPER,
|
||||
CHARACTER_TIPTUP,
|
||||
CHARACTER_CONKER,
|
||||
CHARACTER_TIMBER,
|
||||
CHARACTER_BANJO,
|
||||
CHARACTER_DRUMSTICK,
|
||||
CHARACTER_PIPSY,
|
||||
CHARACTER_TT,
|
||||
CHARACTER_DIDDY,
|
||||
NUMBER_OF_CHARACTERS
|
||||
} Character;
|
||||
|
||||
typedef enum Vehicle {
|
||||
VEHICLE_CAR,
|
||||
VEHICLE_HOVERCRAFT,
|
||||
@@ -78,6 +92,14 @@ typedef enum RaceType {
|
||||
RACETYPE_CHALLENGE_EGGS = 66
|
||||
} RaceType;
|
||||
|
||||
typedef enum ObjectModelType {
|
||||
OBJECT_MODEL_TYPE_3D_MODEL,
|
||||
OBJECT_MODEL_TYPE_SPRITE_BILLBOARD,
|
||||
OBJECT_MODEL_TYPE_VEHICLE_PART,
|
||||
OBJECT_MODEL_TYPE_UNKNOWN3,
|
||||
OBJECT_MODEL_TYPE_MISC
|
||||
} ObjectModelType;
|
||||
|
||||
typedef enum HorizontalAlignmentFlags {
|
||||
HORZ_ALIGN_LEFT = 0,
|
||||
HORZ_ALIGN_RIGHT = 1,
|
||||
|
||||
@@ -29,6 +29,7 @@ typedef struct LevelObjectEntry_Animator {
|
||||
/* 0x08 */ s8 batchID;
|
||||
/* 0x09 */ s8 speedFactorX;
|
||||
/* 0x0A */ s8 speedfactorY;
|
||||
/* 0x0B */ s8 padB;
|
||||
} LevelObjectEntry_Animator;
|
||||
|
||||
typedef struct LevelObjectEntry_Weapon {
|
||||
@@ -72,6 +73,7 @@ typedef struct LevelObjectEntry_Exit {
|
||||
// 0: Warps to a boss 1 race
|
||||
// 1: Warps to a boss 2 race
|
||||
/* 0x18 */ s8 bossFlag;
|
||||
/* 0x19 */ u8 pad19;
|
||||
} LevelObjectEntry_Exit;
|
||||
|
||||
typedef struct LevelObjectEntry_Audio {
|
||||
@@ -83,6 +85,7 @@ typedef struct LevelObjectEntry_Audio {
|
||||
/* 0x0E */ u8 unkE;
|
||||
/* 0x0F */ u8 unkF;
|
||||
/* 0x10 */ u8 unk10;
|
||||
/* 0x11 */ u8 unk11;
|
||||
} LevelObjectEntry_Audio;
|
||||
|
||||
typedef struct LevelObjectEntry_AudioLine {
|
||||
@@ -102,6 +105,7 @@ typedef struct LevelObjectEntry_AudioLine {
|
||||
typedef struct LevelObjectEntry_CameraControl {
|
||||
/* 0x00 */ LevelObjectEntryCommon common;
|
||||
/* 0x08 */ s8 unk8;
|
||||
/* 0x09 */ s8 pad9;
|
||||
} LevelObjectEntry_CameraControl;
|
||||
|
||||
typedef struct LevelObjectEntry_SetupPoint {
|
||||
@@ -136,6 +140,8 @@ typedef struct LevelObjectEntry_Checkpoint {
|
||||
/* 0x17 */ s8 unk17;
|
||||
/* 0x18 */ s8 unk18;
|
||||
/* 0x19 */ u8 unk19;
|
||||
/* 0x1A */ u8 unk1A;
|
||||
/* 0x1B */ u8 unk1B;
|
||||
} LevelObjectEntry_Checkpoint;
|
||||
|
||||
typedef struct LevelObjectEntry_Door {
|
||||
@@ -173,6 +179,7 @@ typedef struct LevelObjectEntry_AiNode {
|
||||
/* 0x09 */ u8 unk9;
|
||||
/* 0x0A */ u8 unkA[4];
|
||||
/* 0x0E */ s8 unkE;
|
||||
/* 0x0F */ s8 padF;
|
||||
} LevelObjectEntry_AiNode;
|
||||
|
||||
#define BALLOON_TYPE_BOOST 0
|
||||
@@ -186,10 +193,12 @@ typedef struct LevelObjectEntry_WeaponBalloon {
|
||||
/* 0x08 */ u8 unk8; // Unused?
|
||||
/* 0x09 */ u8 balloonType;
|
||||
/* 0x0A */ u8 radius; // This is divided by 64 to get actual scale.
|
||||
/* 0x0B */ u8 padB;
|
||||
} LevelObjectEntry_WeaponBalloon;
|
||||
|
||||
typedef struct LevelObjectEntry_AudioSeqLine {
|
||||
/* 0x00 */ LevelObjectEntryCommon common;
|
||||
/* 0x08 */ u8 unk8[0xC];
|
||||
} LevelObjectEntry_AudioSeqLine;
|
||||
|
||||
typedef struct LevelObjectEntry_BombExplosion {
|
||||
@@ -216,12 +225,15 @@ typedef struct LevelObjectEntry_AudioReverb {
|
||||
/* 0x08 */ u8 unk8;
|
||||
/* 0x09 */ u8 lineID;
|
||||
/* 0x0A */ u8 unkA;
|
||||
/* 0x0A */ u8 unkB;
|
||||
} LevelObjectEntry_AudioReverb;
|
||||
|
||||
typedef struct LevelObjectEntry_Torch_Mist {
|
||||
/* 0x00 */ LevelObjectEntryCommon common;
|
||||
/* 0x08 */ u8 animSpeed;
|
||||
/* 0x09 */ u8 radius;
|
||||
/* 0x0A */ u8 unkA;
|
||||
/* 0x0B */ u8 unkB;
|
||||
} LevelObjectEntry_Torch_Mist;
|
||||
|
||||
typedef struct LevelObjectEntry_TexScroll {
|
||||
@@ -236,10 +248,12 @@ typedef struct LevelObjectEntry_ModeChange {
|
||||
/* 0x08 */ u8 radius;
|
||||
/* 0x09 */ u8 angleY;
|
||||
/* 0x0A */ u8 vehicleID;
|
||||
/* 0x0B */ u8 padB;
|
||||
} LevelObjectEntry_ModeChange;
|
||||
|
||||
typedef struct LevelObjectEntry_StopWatchMan {
|
||||
/* 0x00 */ LevelObjectEntryCommon common;
|
||||
/* 0x08 */ u8 unk8[4];
|
||||
} LevelObjectEntry_StopWatchMan;
|
||||
|
||||
typedef struct LevelObjectEntry_Banana {
|
||||
@@ -266,6 +280,7 @@ typedef struct LevelObjectEntry_RgbaLight {
|
||||
|
||||
typedef struct LevelObjectEntry_Buoy_PirateShip {
|
||||
/* 0x00 */ LevelObjectEntryCommon common;
|
||||
/* 0x08 */ u8 unk8[4];
|
||||
} LevelObjectEntry_Buoy_PirateShip;
|
||||
|
||||
typedef struct LevelObjectEntry_Weather {
|
||||
@@ -294,6 +309,7 @@ typedef struct LevelObjectEntry_Bridge_WhaleRamp {
|
||||
typedef struct LevelObjectEntry_RampSwitch {
|
||||
/* 0x00 */ LevelObjectEntryCommon common;
|
||||
/* 0x08 */ u8 unk8;
|
||||
/* 0x09 */ u8 unk9;
|
||||
} LevelObjectEntry_RampSwitch;
|
||||
|
||||
typedef struct LevelObjectEntry_SeaMonster {
|
||||
@@ -315,11 +331,13 @@ typedef struct LevelObjectEntry_LensFlare {
|
||||
/* 0x0D */ u8 unkD;
|
||||
/* 0x0E */ u8 unkE;
|
||||
/* 0x0F */ u8 unkF;
|
||||
/* 0x10 */ u8 unk10[4];
|
||||
} LevelObjectEntry_LensFlare;
|
||||
|
||||
typedef struct LevelObjectEntry_LensFlareSwitch {
|
||||
/* 0x00 */ LevelObjectEntryCommon common;
|
||||
/* 0x08 */ s16 radius;
|
||||
/* 0x0A */ u8 unkA[10];
|
||||
} LevelObjectEntry_LensFlareSwitch;
|
||||
|
||||
typedef struct LevelObjectEntry_CollectEgg {
|
||||
@@ -406,6 +424,7 @@ typedef struct LevelObjectEntry_AirZippers_WaterZippers {
|
||||
/* 0x08 */ u8 unk8;
|
||||
/* 0x09 */ u8 radius;
|
||||
/* 0x0A */ u8 angleY;
|
||||
/* 0x0B */ u8 padB;
|
||||
} LevelObjectEntry_AirZippers_WaterZippers;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown58 {
|
||||
@@ -414,6 +433,7 @@ typedef struct LevelObjectEntry_Unknown58 {
|
||||
|
||||
typedef struct LevelObjectEntry_WaveGenerator {
|
||||
/* 0x00 */ LevelObjectEntryCommon common;
|
||||
/* 0x08 */ u8 unk8[10];
|
||||
} LevelObjectEntry_WaveGenerator;
|
||||
|
||||
typedef struct LevelObjectEntry_Butterfly {
|
||||
@@ -442,6 +462,7 @@ typedef struct LevelObjectEntry_Parkwarden {
|
||||
typedef struct LevelObjectEntry_WorldKey {
|
||||
/* 0x00 */ LevelObjectEntryCommon common;
|
||||
/* 0x08 */ u8 keyID;
|
||||
/* 0x09 */ u8 pad9;
|
||||
} LevelObjectEntry_WorldKey;
|
||||
|
||||
typedef struct LevelObjectEntry_BananaCreator {
|
||||
@@ -451,6 +472,7 @@ typedef struct LevelObjectEntry_BananaCreator {
|
||||
typedef struct LevelObjectEntry_TreasureSucker {
|
||||
/* 0x00 */ LevelObjectEntryCommon common;
|
||||
/* 0x08 */ s8 playerID;
|
||||
/* 0x09 */ u8 pad9;
|
||||
} LevelObjectEntry_TreasureSucker;
|
||||
|
||||
typedef struct LevelObjectEntry_Log {
|
||||
@@ -458,6 +480,7 @@ typedef struct LevelObjectEntry_Log {
|
||||
/* 0x08 */ u8 modelIndex;
|
||||
/* 0x09 */ u8 radius;
|
||||
/* 0x0A */ u8 angleY;
|
||||
/* 0x0B */ u8 padB;
|
||||
} LevelObjectEntry_Log;
|
||||
|
||||
typedef struct LevelObjectEntry_LavaSpurt {
|
||||
@@ -495,11 +518,14 @@ typedef struct LevelObjectEntry_EffectBox {
|
||||
/* 0x0B */ u8 unkB;
|
||||
/* 0x0C */ u8 unkC;
|
||||
/* 0x0D */ u8 unkD;
|
||||
/* 0x0E */ u8 unkE;
|
||||
/* 0x0F */ u8 unkF;
|
||||
} LevelObjectEntry_EffectBox;
|
||||
|
||||
typedef struct LevelObjectEntry_TrophyCab {
|
||||
/* 0x00 */ LevelObjectEntryCommon common;
|
||||
/* 0x08 */ u8 angleY;
|
||||
/* 0x09 */ u8 pad9;
|
||||
} LevelObjectEntry_TrophyCab;
|
||||
|
||||
typedef struct LevelObjectEntry_Bubbler {
|
||||
@@ -507,6 +533,7 @@ typedef struct LevelObjectEntry_Bubbler {
|
||||
/* 0x08 */ u8 particlePropertyID;
|
||||
/* 0x09 */ u8 particleBehaviourID;
|
||||
/* 0x0A */ u16 unkA;
|
||||
/* 0x0C */ u8 unkC[4];
|
||||
} LevelObjectEntry_Bubbler;
|
||||
|
||||
typedef struct LevelObjectEntry_FlyCoin {
|
||||
@@ -518,6 +545,7 @@ typedef struct LevelObjectEntry_GoldenBalloon {
|
||||
/* 0x08 */ s8 balloonID;
|
||||
/* 0x09 */ u8 scale;
|
||||
/* 0x0A */ s8 challengeID;
|
||||
/* 0x0B */ u8 padB;
|
||||
} LevelObjectEntry_GoldenBalloon;
|
||||
|
||||
typedef struct LevelObjectEntry_Laserbolt {
|
||||
@@ -539,6 +567,7 @@ typedef struct LevelObjectEntry_GroundZipper {
|
||||
/* 0x08 */ u8 unk8;
|
||||
/* 0x09 */ u8 scale;
|
||||
/* 0x0A */ u8 angleY;
|
||||
/* 0x0B */ u8 unkB;
|
||||
} LevelObjectEntry_GroundZipper;
|
||||
|
||||
typedef struct LevelObjectEntry_OverridePos {
|
||||
@@ -557,9 +586,14 @@ typedef struct LevelObjectEntry_SilverCoin {
|
||||
|
||||
typedef struct LevelObjectEntry_Boost {
|
||||
/* 0x00 */ LevelObjectEntryCommon common;
|
||||
/* 0x08 */ s8 unk8[1];
|
||||
} LevelObjectEntry_Boost;
|
||||
|
||||
// The object map file expects 8 bytes, but the in-game function expects something different?
|
||||
typedef struct LevelObjectEntry_Boost2 {
|
||||
/* 0x00 */ LevelObjectEntryCommon common;
|
||||
/* 0x08 */ s8 unk8[1];
|
||||
} LevelObjectEntry_Boost2;
|
||||
|
||||
typedef struct LevelObjectEntry_WardenSmoke {
|
||||
/* 0x00 */ LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_WardenSmoke;
|
||||
@@ -579,6 +613,7 @@ typedef struct LevelObjectEntry_Snowball {
|
||||
typedef struct LevelObjectEntry_Teleport {
|
||||
/* 0x00 */ LevelObjectEntryCommon common;
|
||||
/* 0x08 */ s8 levelID;
|
||||
/* 0x09 */ u8 pad9;
|
||||
} LevelObjectEntry_Teleport;
|
||||
|
||||
typedef struct LevelObjectEntry_Lighthouse_RocketSignpost {
|
||||
@@ -586,6 +621,7 @@ typedef struct LevelObjectEntry_Lighthouse_RocketSignpost {
|
||||
/* 0x08 */ u8 unk8;
|
||||
/* 0x09 */ u8 radius;
|
||||
/* 0x0A */ u8 angleY;
|
||||
/* 0x0B */ u8 padB;
|
||||
} LevelObjectEntry_Lighthouse_RocketSignpost;
|
||||
|
||||
typedef struct LevelObjectEntry_Windsail {
|
||||
@@ -606,6 +642,7 @@ typedef struct LevelObjectEntry_Frog {
|
||||
/* 0x00 */ LevelObjectEntryCommon common;
|
||||
/* 0x08 */ s16 homeRadius;
|
||||
/* 0x0A */ u8 drumstick;
|
||||
/* 0x0B */ u8 padB;
|
||||
} LevelObjectEntry_Frog;
|
||||
|
||||
typedef struct LevelObjectEntry_SilverCoinAdv2 {
|
||||
@@ -621,6 +658,7 @@ typedef struct LevelObjectEntry_TTDoor {
|
||||
/* 0x0C */ u8 radius;
|
||||
/* 0x0D */ u8 padD;
|
||||
/* 0x0E */ s8 doorID;
|
||||
/* 0x0F */ s8 padF;
|
||||
} LevelObjectEntry_TTDoor;
|
||||
|
||||
typedef struct LevelObjectEntry_MidiFadePoint {
|
||||
@@ -629,6 +667,7 @@ typedef struct LevelObjectEntry_MidiFadePoint {
|
||||
/* 0x0A */ u16 unkA;
|
||||
/* 0x0C */ u8 unkC[16];
|
||||
/* 0x1C */ u8 unk1C;
|
||||
/* 0x1D */ u8 unk1D;
|
||||
} LevelObjectEntry_MidiFadePoint;
|
||||
|
||||
typedef struct LevelObjectEntry_OctoBubble {
|
||||
@@ -723,6 +762,125 @@ typedef struct LevelObjectEntry_Unk8000CC7C {
|
||||
s16 unkE;
|
||||
} LevelObjectEntry_Unk8000CC7C;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown20 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown20;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown21 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown21;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown24 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown24;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown34 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown34;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown35 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown35;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown42 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown42;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown48 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown48;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown63 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown63;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown91 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown91;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown92 {
|
||||
LevelObjectEntryCommon common;
|
||||
u8 unk8;
|
||||
u8 unk9;
|
||||
} LevelObjectEntry_Unknown92;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown106 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown106;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown114 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown114;
|
||||
|
||||
typedef struct LevelObjectEntry_AnimatedObject {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_AnimatedObject;
|
||||
|
||||
typedef struct LevelObjectEntry_DynamicLightObject2 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_DynamicLightObject2;
|
||||
|
||||
typedef struct LevelObjectEntry_ParkWarden {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_ParkWarden;
|
||||
|
||||
typedef struct LevelObjectEntry_TajTelepoint {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_TajTelepoint;
|
||||
|
||||
typedef struct LevelObjectEntry_CameraAnimation {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_CameraAnimation;
|
||||
|
||||
typedef struct LevelObjectEntry_BossHazardTrigger {
|
||||
LevelObjectEntryCommon common;
|
||||
u8 unk8[4];
|
||||
} LevelObjectEntry_BossHazardTrigger;
|
||||
|
||||
typedef struct LevelObjectEntry_DoorOpener {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_DoorOpener;
|
||||
|
||||
typedef struct LevelObjectEntry_PigRocketeer {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_PigRocketeer;
|
||||
|
||||
typedef struct LevelObjectEntry_WizpigGhosts {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_WizpigGhosts;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown120 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown120;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown121 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown121;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown122 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown122;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown123 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown123;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown124 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown124;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown125 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown125;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown126 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown126;
|
||||
|
||||
typedef struct LevelObjectEntry_Unknown127 {
|
||||
LevelObjectEntryCommon common;
|
||||
} LevelObjectEntry_Unknown127;
|
||||
|
||||
typedef struct LevelObjectEntry {
|
||||
union {
|
||||
LevelObjectEntry_Racer racer;
|
||||
|
||||
@@ -0,0 +1,135 @@
|
||||
#ifndef _OBJECT_BEHAVIORS_H_
|
||||
#define _OBJECT_BEHAVIORS_H_
|
||||
|
||||
enum ObjectBehaviours {
|
||||
BHV_NONE,
|
||||
BHV_RACER,
|
||||
BHV_SCENERY,
|
||||
BHV_FISH,
|
||||
BHV_ANIMATOR,
|
||||
BHV_WEAPON,
|
||||
BHV_SMOKE,
|
||||
BHV_EXIT,
|
||||
BHV_AUDIO,
|
||||
BHV_AUDIO_LINE,
|
||||
BHV_CAMERA_CONTROL,
|
||||
BHV_SETUP_POINT,
|
||||
BHV_DINO_WHALE,
|
||||
BHV_CHECKPOINT,
|
||||
BHV_DOOR,
|
||||
BHV_FOG_CHANGER,
|
||||
BHV_AINODE,
|
||||
BHV_WEAPON_BALLOON,
|
||||
BHV_WEAPON_2,
|
||||
BHV_AUDIO_LINE_2,
|
||||
BHV_UNK_14,
|
||||
BHV_UNK_15,
|
||||
BHV_BOMB_EXPLOSION,
|
||||
BHV_BALLOON_POP,
|
||||
BHV_UNK_18,
|
||||
BHV_UNK_19,
|
||||
BHV_SKY_CONTROL,
|
||||
BHV_AUDIO_REVERB,
|
||||
BHV_TORCH_MIST,
|
||||
BHV_TEXTURE_SCROLL,
|
||||
BHV_MODECHANGE,
|
||||
BHV_STOPWATCH_MAN,
|
||||
BHV_BANANA,
|
||||
BHV_LIGHT_RGBA,
|
||||
BHV_UNK_22,
|
||||
BHV_UNK_23,
|
||||
BHV_BUOY_PIRATE_SHIP,
|
||||
BHV_WEATHER,
|
||||
BHV_BRIDGE_WHALE_RAMP,
|
||||
BHV_RAMP_SWITCH,
|
||||
BHV_SEA_MONSTER,
|
||||
BHV_BONUS,
|
||||
BHV_UNK_2A,
|
||||
BHV_LENS_FLARE,
|
||||
BHV_LENS_FLARE_SWITCH,
|
||||
BHV_COLLECT_EGG,
|
||||
BHV_EGG_CREATOR,
|
||||
BHV_CHARACTER_FLAG,
|
||||
BHV_UNK_30,
|
||||
BHV_ANIMATION,
|
||||
BHV_ANIMATED_OBJECT,
|
||||
BHV_CAMERA_ANIMATION,
|
||||
BHV_INFO_POINT,
|
||||
BHV_CAR_ANIMATION,
|
||||
BHV_CHARACTER_SELECT,
|
||||
BHV_TRIGGER,
|
||||
BHV_VEHICLE_ANIMATION,
|
||||
BHV_ZIPPER_WATER,
|
||||
BHV_UNK_3A,
|
||||
BHV_WAVE_GENERATOR,
|
||||
BHV_WAVE_POWER,
|
||||
BHV_BUTTERFLY,
|
||||
BHV_PARK_WARDEN,
|
||||
BHV_UNK_3F,
|
||||
BHV_WORLD_KEY,
|
||||
BHV_BANANA_SPAWNER,
|
||||
BHV_TREASURE_SUCKER,
|
||||
BHV_LOG,
|
||||
BHV_LAVA_SPURT,
|
||||
BHV_POS_ARROW,
|
||||
BHV_HIT_TESTER,
|
||||
BHV_MIDI_FADE,
|
||||
BHV_HIT_TESTER_2,
|
||||
BHV_EFFECT_BOX,
|
||||
BHV_TROPHY_CABINET,
|
||||
BHV_BUBBLER,
|
||||
BHV_FLY_COIN,
|
||||
BHV_GOLDEN_BALLOON,
|
||||
BHV_LASER_BOLT,
|
||||
BHV_LASER_GUN,
|
||||
BHV_PARK_WARDEN_2,
|
||||
BHV_ANIMATED_OBJECT_2,
|
||||
BHV_ZIPPER_GROUND,
|
||||
BHV_OVERRIDE_POS,
|
||||
BHV_WIZPIG_SHIP,
|
||||
BHV_ANIMATED_OBJECT_3,
|
||||
BHV_ANIMATED_OBJECT_4,
|
||||
BHV_TAJ_TELEPOINT,
|
||||
BHV_SILVER_COIN,
|
||||
BHV_BOOST,
|
||||
BHV_WARDEN_SMOKE,
|
||||
BHV_UNK_5B,
|
||||
BHV_UNK_5C,
|
||||
BHV_ZIPPER_AIR,
|
||||
BHV_UNK_5E,
|
||||
BHV_DYNAMIC_LIGHT_OBJECT_2,
|
||||
BHV_SNOWBALL,
|
||||
BHV_SNOWBALL_2,
|
||||
BHV_TELEPORT,
|
||||
BHV_ROCKET_SIGNPOST,
|
||||
BHV_ROCKET_SIGNPOST_2,
|
||||
BHV_SNOWBALL_3,
|
||||
BHV_SNOWBALL_4,
|
||||
BHV_HIT_TESTER_3,
|
||||
BHV_HIT_TESTER_4,
|
||||
BHV_RANGE_TRIGGER,
|
||||
BHV_UNK_6A,
|
||||
BHV_BOSS_HAZARD_TRIGGER,
|
||||
BHV_FIREBALL_OCTOWEAPON,
|
||||
BHV_FROG,
|
||||
BHV_SILVER_COIN_2,
|
||||
BHV_TT_DOOR,
|
||||
BHV_MIDI_FADE_POINT,
|
||||
BHV_DOOR_OPENER,
|
||||
BHV_UNK_72,
|
||||
BHV_PIG_ROCKETEER,
|
||||
BHV_FIREBALL_OCTOWEAPON_2,
|
||||
BHV_LEVEL_NAME,
|
||||
BHV_MIDI_CHANNEL_SET,
|
||||
BHV_WIZPIG_GHOSTS,
|
||||
BHV_UNK_78,
|
||||
BHV_UNK_79,
|
||||
BHV_UNK_7A,
|
||||
BHV_UNK_7B,
|
||||
BHV_UNK_7C,
|
||||
BHV_UNK_7D,
|
||||
BHV_UNK_7E,
|
||||
BHV_UNK_7F
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -705,14 +705,6 @@ typedef struct LevelModel {
|
||||
/* 0x48 */ s32 modelSize;
|
||||
} LevelModel;
|
||||
|
||||
typedef enum {
|
||||
OBJECT_MODEL_TYPE_3D_MODEL,
|
||||
OBJECT_MODEL_TYPE_SPRITE_BILLBOARD,
|
||||
OBJECT_MODEL_TYPE_VEHICLE_PART,
|
||||
OBJECT_MODEL_TYPE_UNKNOWN3,
|
||||
OBJECT_MODEL_TYPE_MISC
|
||||
} ObjectModelType;
|
||||
|
||||
typedef struct ObjHeaderParticleEntry {
|
||||
/* 0x00 */ s32 upper;
|
||||
/* 0x04 */ s32 lower;
|
||||
|
||||
@@ -5668,7 +5668,7 @@ void obj_loop_bubbler(Object *obj, s32 updateRate) {
|
||||
}
|
||||
}
|
||||
|
||||
void obj_init_boost(Object *obj, LevelObjectEntry_Boost *entry) {
|
||||
void obj_init_boost(Object *obj, LevelObjectEntry_Boost2 *entry) {
|
||||
obj->unk64 = (Object_64 *) ((s32) get_misc_asset(ASSET_MISC_20) + (entry->unk8[0] << 7));
|
||||
obj->segment.level_entry = NULL;
|
||||
}
|
||||
|
||||
@@ -346,7 +346,7 @@ void obj_init_wavegenerator(Object *obj, LevelObjectEntry_WaveGenerator *entry,
|
||||
void obj_init_midichset(Object *obj, LevelObjectEntry_Midichset *entry);
|
||||
void obj_init_bubbler(Object *obj, LevelObjectEntry_Bubbler *entry);
|
||||
void obj_loop_bubbler(Object *obj, s32 updateRate);
|
||||
void obj_init_boost(Object *obj, LevelObjectEntry_Boost *entry);
|
||||
void obj_init_boost(Object *obj, LevelObjectEntry_Boost2 *entry);
|
||||
void obj_init_unknown94(Object *obj, LevelObjectEntry_Unknown94 *entry, s32 arg2);
|
||||
void obj_loop_unknown94(Object *obj, s32 updateRate);
|
||||
void obj_init_rangetrigger(Object *obj, LevelObjectEntry_RangeTrigger *entry);
|
||||
|
||||
+10
-6
@@ -1,11 +1,16 @@
|
||||
|
||||
OPT := -O2
|
||||
|
||||
CC := gcc
|
||||
CXX := g++
|
||||
CFLAGS := -I . -Wall -Wextra -Wno-unused-parameter -pedantic -std=c99 -O2 -s
|
||||
CXXFLAGS := -I . -Wall -Wextra -std=c++17
|
||||
CFLAGS := -I . -Wall -Wextra -Wno-unused-parameter -pedantic -std=c99 $(OPT) -s
|
||||
# List of specific errors to ignore
|
||||
IGNORE_W_ERRORS := -Wno-unused-parameter -Wno-misleading-indentation -Wno-extra
|
||||
CXXFLAGS := -I . -I dkr_assets_tool_src/ -Werror -Wall $(IGNORE_W_ERRORS) -std=c++17 $(OPT) -lpcre2-8
|
||||
LDFLAGS := -lm
|
||||
PROGRAMS := n64crc dkr_assets_tool
|
||||
|
||||
BUILD_DIR := dkr_assets_tool_classes/_build
|
||||
BUILD_DIR := dkr_assets_tool_src/_build
|
||||
|
||||
ENUMS_HEADER := ../include/enums.h
|
||||
|
||||
@@ -29,10 +34,9 @@ distclean: clean
|
||||
n64crc: n64crc.c
|
||||
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
|
||||
|
||||
dkr_assets_tool_CPP_FILES := dkr_assets_tool.cpp \
|
||||
$(call rwildcard,dkr_assets_tool_classes,*.cpp)
|
||||
dkr_assets_tool_CPP_FILES := $(call rwildcard,dkr_assets_tool_src,*.cpp)
|
||||
|
||||
dkr_assets_tool_C_FILES := $(call rwildcard,dkr_assets_tool_classes,*.c)
|
||||
dkr_assets_tool_C_FILES := $(call rwildcard,dkr_assets_tool_src,*.c)
|
||||
|
||||
dkr_assets_tool_OBJ_FILES := $(foreach file,$(dkr_assets_tool_C_FILES),$(BUILD_DIR)/$(file:.c=.o)) \
|
||||
$(foreach file,$(dkr_assets_tool_CPP_FILES),$(BUILD_DIR)/$(file:.cpp=.o))
|
||||
|
||||
@@ -1,204 +0,0 @@
|
||||
/**
|
||||
* This tool handles everything assets-related including extracting and building.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "dkr_assets_tool_classes/common/util.h"
|
||||
#include "dkr_assets_tool_classes/extractor/extractor.h"
|
||||
#include "dkr_assets_tool_classes/builder/builder.h"
|
||||
#include "dkr_assets_tool_classes/make_asset_files/asset_enums_header.h"
|
||||
#include "dkr_assets_tool_classes/make_asset_files/asset_asm_data.h"
|
||||
#include "dkr_assets_tool_classes/compiler/compiler.h"
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
void print_usage() {
|
||||
std::cout << "---- Usages -------------------------------------------------------------" << std::endl;
|
||||
std::cout << "Extracting assets: ./dkr_assets_tool -e <version> <configs path> <baseroms path> <output path>" << std::endl;
|
||||
std::cout << "Building an asset: ./dkr_assets_tool -b <version> <assets path> <source path> <output path>" << std::endl;
|
||||
std::cout << "Build enums cache: ./dkr_assets_tool -bc <version> <enums.h path>" << std::endl;
|
||||
std::cout << "Creating includes: ./dkr_assets_tool -i <version> <assets path> <include directory> <build directory> <asm output directory>" << std::endl;
|
||||
std::cout << "Compiling assets: ./dkr_assets_tool -c <version> <assets path>" << std::endl;
|
||||
std::cout << "Compress file: ./dkr_assets_tool -fc <input_filename> <output_filename>" << std::endl;
|
||||
std::cout << "Decompress file: ./dkr_assets_tool -fd <input_filename> <output_filename>" << std::endl;
|
||||
std::cout << "-------------------------------------------------------------------------" << std::endl;
|
||||
}
|
||||
|
||||
/**************************************************************************/
|
||||
|
||||
struct Command {
|
||||
std::string flag;
|
||||
int args;
|
||||
void (*func)(const std::vector<std::string>&);
|
||||
};
|
||||
|
||||
void extract(const std::vector<std::string>& args);
|
||||
void build(const std::vector<std::string>& args);
|
||||
void asset_includes(const std::vector<std::string>& args);
|
||||
void asset_compile(const std::vector<std::string>& args);
|
||||
void asset_compress(const std::vector<std::string>& args);
|
||||
void asset_decompress(const std::vector<std::string>& args);
|
||||
void build_enums_cache(const std::vector<std::string>& args);
|
||||
|
||||
static const std::vector<Command> COMMANDS = {
|
||||
// Extract
|
||||
{
|
||||
.flag = "-e",
|
||||
.args = 5,
|
||||
.func = &extract,
|
||||
},
|
||||
// Build
|
||||
{
|
||||
.flag = "-b",
|
||||
.args = 4,
|
||||
.func = build,
|
||||
},
|
||||
// Build enums cache
|
||||
{
|
||||
.flag = "-bc",
|
||||
.args = 2,
|
||||
.func = build_enums_cache,
|
||||
},
|
||||
// Asset includes
|
||||
{
|
||||
.flag = "-i",
|
||||
.args = 5,
|
||||
.func = asset_includes,
|
||||
},
|
||||
// Asset compile
|
||||
{
|
||||
.flag = "-c",
|
||||
.args = 2,
|
||||
.func = asset_compile,
|
||||
},
|
||||
// Asset compress file
|
||||
{
|
||||
.flag = "-fc",
|
||||
.args = 2,
|
||||
.func = asset_compress,
|
||||
},
|
||||
// Asset decompress file
|
||||
{
|
||||
.flag = "-fd",
|
||||
.args = 2,
|
||||
.func = asset_decompress,
|
||||
},
|
||||
};
|
||||
|
||||
void extract(const std::vector<std::string>& args) {
|
||||
std::string version = args[0]; // us_1.0
|
||||
std::string assetsDir = args[1]; // <root>/assets
|
||||
std::string configsPath = args[2]; // <root>/extract-ver
|
||||
std::string baseromsPath = args[3]; // <root>/baseroms
|
||||
std::string outputPath = args[4]; // <root>
|
||||
|
||||
set_assets_folder_path(assetsDir + "/vanilla");
|
||||
set_version(version);
|
||||
|
||||
Extractor extractor(version, configsPath, baseromsPath, outputPath);
|
||||
}
|
||||
|
||||
void build(const std::vector<std::string>& args) {
|
||||
std::string version = args[0]; // us_1.0
|
||||
std::string assetsDir = args[1]; // <root>/assets
|
||||
std::string sourcePath = args[2]; // Input .json filepath
|
||||
std::string outputPath = args[3]; // Output .bin filepath
|
||||
|
||||
set_assets_folder_path(assetsDir);
|
||||
set_version(version);
|
||||
|
||||
Builder builder(sourcePath, outputPath);
|
||||
}
|
||||
|
||||
void asset_includes(const std::vector<std::string>& args) {
|
||||
std::string version = args[0]; // us_1.0
|
||||
std::string assetsDir = args[1]; // <root>/assets
|
||||
std::string includeDir = args[2]; // <root>/include
|
||||
std::string buildDir = args[3]; // <root>/build
|
||||
std::string assetsAsmDir = args[4]; // <root>/asm/assets
|
||||
|
||||
set_assets_folder_path(assetsDir);
|
||||
set_version(version);
|
||||
|
||||
AssetEnumsHeader assetEnumsHeader(includeDir);
|
||||
AssetAsmIncludes assetAsmIncludes(assetsDir + "/" + version, buildDir + "/" + version + "/assets", assetsAsmDir);
|
||||
}
|
||||
|
||||
void asset_compile(const std::vector<std::string>& args) {
|
||||
std::string version = args[0]; // us_1.0
|
||||
std::string assetsDir = args[1]; // <root>/assets
|
||||
|
||||
set_assets_folder_path(assetsDir);
|
||||
set_version(version);
|
||||
|
||||
AssetCompiler compiler;
|
||||
}
|
||||
|
||||
void asset_compress(const std::vector<std::string>& args) {
|
||||
DKRCompression compression;
|
||||
std::string inputFilename = args[0];
|
||||
std::string outputFilename = args[1];
|
||||
std::vector<uint8_t> inputBinary, outputBinary;
|
||||
|
||||
if(compression.readBinaryFile(inputBinary, inputFilename)) {
|
||||
if(inputBinary.size() == 0) {
|
||||
compression.writeBinaryFile(inputBinary, outputFilename);
|
||||
} else {
|
||||
outputBinary = compression.compressBuffer(inputBinary);
|
||||
compression.writeBinaryFile(outputBinary, outputFilename);
|
||||
}
|
||||
} else {
|
||||
display_error_and_abort("Could not read file: ", inputFilename);
|
||||
}
|
||||
}
|
||||
|
||||
void asset_decompress(const std::vector<std::string>& args) {
|
||||
DKRCompression compression;
|
||||
std::string inputFilename = args[0];
|
||||
std::string outputFilename = args[1];
|
||||
std::vector<uint8_t> inputBinary, outputBinary;
|
||||
|
||||
if(compression.readBinaryFile(inputBinary, inputFilename)) {
|
||||
if(inputBinary.size() == 0) {
|
||||
compression.writeBinaryFile(inputBinary, outputFilename);
|
||||
} else {
|
||||
outputBinary = compression.decompressBuffer(inputBinary);
|
||||
compression.writeBinaryFile(outputBinary, outputFilename);
|
||||
}
|
||||
} else {
|
||||
display_error_and_abort("Could not read file: ", inputFilename);
|
||||
}
|
||||
}
|
||||
|
||||
void build_enums_cache(const std::vector<std::string>& args) {
|
||||
std::string version = args[0]; // us_1.0
|
||||
std::string enumsHeaderPath = args[1]; // <root>/include/enums.h
|
||||
|
||||
set_version(version);
|
||||
generate_enums_cache(enumsHeaderPath);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
if (argc == 1) {
|
||||
print_usage();
|
||||
return 1;
|
||||
}
|
||||
std::string flag = argv[1];
|
||||
auto it = std::find_if(COMMANDS.begin(), COMMANDS.end(), [&flag](const Command& cmd) {
|
||||
return cmd.flag == flag;
|
||||
});
|
||||
if (it == COMMANDS.end()) {
|
||||
print_usage();
|
||||
return 1;
|
||||
}
|
||||
if (argc - 2 != it->args) {
|
||||
display_error_and_abort("Expected ", it->args, " args but was given ", argc - 2, ".");
|
||||
return 1;
|
||||
}
|
||||
std::vector<std::string> args(argv + 2, argv + argc);
|
||||
it->func(args);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
#include "build_fonts.h"
|
||||
|
||||
#define SIZEOF_FONTS_HEADER 4
|
||||
|
||||
// Note that these are just for DKR afaik. Other rare games have different sizes.
|
||||
#define SIZEOF_FONT 0x400 // Larger in later Rare games
|
||||
#define MAX_NUMBER_OF_TEXTURES 32 // Extended to 64 in later Rare games
|
||||
#define CHAR_NODE_START_OFFSET 32
|
||||
#define NUMBER_OF_CHAR_NODES 96 // Extended to 224 in later Rare games
|
||||
#define CHAR_NODE_END_OFFSET CHAR_NODE_START_OFFSET + NUMBER_OF_CHAR_NODES
|
||||
#define SIZEOF_CHAR_NODE 8
|
||||
|
||||
BuildFonts::BuildFonts(std::string srcPath, std::string dstPath) {
|
||||
|
||||
std::string fontFolderPath = get_directory_from_full_path(srcPath);
|
||||
|
||||
std::vector<std::string> fontIds = get_array_from_section("ASSET_FONTS", "fonts-order");
|
||||
int numberOfFonts = fontIds.size();
|
||||
|
||||
std::vector<uint8_t> out(align16(SIZEOF_FONT * numberOfFonts + SIZEOF_FONTS_HEADER));
|
||||
|
||||
// Write header.
|
||||
write_big_endian_word(out, 0, numberOfFonts);
|
||||
|
||||
// Write fonts.
|
||||
for(int font = 0; font < numberOfFonts; font++) {
|
||||
std::string fontPath = fontFolderPath + "/" + get_string_from_json(srcPath, "fonts", fontIds[font]);
|
||||
|
||||
int fontOffset = font * SIZEOF_FONT + SIZEOF_FONTS_HEADER;
|
||||
|
||||
insert_ascii(out, fontOffset, get_string_from_json(fontPath, "name"));
|
||||
write_big_endian_halfword(out, fontOffset + 0x20, get_int_from_json(fontPath, "fixed-width"));
|
||||
write_big_endian_halfword(out, fontOffset + 0x22, get_int_from_json(fontPath, "y-offset"));
|
||||
write_big_endian_halfword(out, fontOffset + 0x24, get_int_from_json(fontPath, "special-character-width"));
|
||||
write_big_endian_halfword(out, fontOffset + 0x26, get_int_from_json(fontPath, "tab-width"));
|
||||
insert_ascii(out, fontOffset + 0x28, get_string_from_json(fontPath, "unknown-text"));
|
||||
|
||||
int numberOfTextures = get_array_length_from_json(fontPath, "textures");
|
||||
int texOffset = fontOffset + 0x40;
|
||||
int texIndex = 0;
|
||||
// Write texture ids.
|
||||
for(; texIndex < numberOfTextures; texIndex++) {
|
||||
write_big_endian_halfword(out, texOffset, get_tex_2d_index_from_build_id(get_string_from_json(fontPath, "textures", texIndex)));
|
||||
texOffset += 2;
|
||||
}
|
||||
// Fill rest of the space with -1.
|
||||
for(; texIndex < MAX_NUMBER_OF_TEXTURES; texIndex++) {
|
||||
write_big_endian_halfword(out, texOffset, -1);
|
||||
texOffset += 2;
|
||||
}
|
||||
|
||||
std::string encoding = get_string_from_json(fontPath, "encoding", "type");
|
||||
make_uppercase(encoding);
|
||||
|
||||
bool uppercaseOnly = false;
|
||||
|
||||
if(json_has_key(fontPath, "uppercase-only")) {
|
||||
uppercaseOnly = get_bool_from_json(fontPath, "uppercase-only");
|
||||
}
|
||||
|
||||
// Write character nodes
|
||||
if(encoding == "ASCII") {
|
||||
write_ascii_char_nodes(out, fontPath, fontOffset + 0x100, uppercaseOnly);
|
||||
} else if(encoding == "CUSTOM") {
|
||||
write_custom_char_nodes(out, fontPath, fontOffset + 0x100, uppercaseOnly);
|
||||
} else {
|
||||
display_error_and_abort("Unsupported font encoding type: \"", encoding, "\"");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
write_binary_file(out, dstPath);
|
||||
}
|
||||
|
||||
BuildFonts::~BuildFonts() {
|
||||
|
||||
}
|
||||
|
||||
void write_char_node(std::vector<uint8_t> &out, std::string fontPath, int nodeOffset, std::string &chr) {
|
||||
if(json_has_key(fontPath, "characters", chr)) {
|
||||
out[nodeOffset] = get_int_from_json(fontPath, "characters", chr, "tex-index");
|
||||
out[nodeOffset + 1] = get_int_from_json(fontPath, "characters", chr, "char-width");
|
||||
out[nodeOffset + 2] = get_int_from_json(fontPath, "characters", chr, "offset", 0); // X offset
|
||||
out[nodeOffset + 3] = get_int_from_json(fontPath, "characters", chr, "offset", 1); // Y offset
|
||||
out[nodeOffset + 4] = get_int_from_json(fontPath, "characters", chr, "uv", 0); // U coordinate
|
||||
out[nodeOffset + 5] = get_int_from_json(fontPath, "characters", chr, "uv", 1); // V coordinate
|
||||
out[nodeOffset + 6] = get_int_from_json(fontPath, "characters", chr, "tex-size", 0); // Width
|
||||
out[nodeOffset + 7] = get_int_from_json(fontPath, "characters", chr, "tex-size", 1); // Height
|
||||
} else { // Node doesn't exist, so just mark it as empty.
|
||||
out[nodeOffset] = -1;
|
||||
out[nodeOffset + 1] = 0;
|
||||
out[nodeOffset + 2] = 0;
|
||||
out[nodeOffset + 3] = 0;
|
||||
out[nodeOffset + 4] = 0;
|
||||
out[nodeOffset + 5] = 0;
|
||||
out[nodeOffset + 6] = 0;
|
||||
out[nodeOffset + 7] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void BuildFonts::write_ascii_char_nodes(std::vector<uint8_t> &out, std::string fontPath, int offset, bool uppercaseOnly) {
|
||||
for(int node = CHAR_NODE_START_OFFSET; node < CHAR_NODE_END_OFFSET; node++) {
|
||||
std::string chr;
|
||||
if(node == 127) {
|
||||
chr = "DEL"; // Special case because the delete character itself is sometimes weird.
|
||||
} else if (node == 92) {
|
||||
chr = "\\\\";
|
||||
} else if (node == 34) {
|
||||
chr = "\\\"";
|
||||
} else {
|
||||
chr = (char)node;
|
||||
}
|
||||
int nodeOffset = offset + (node - CHAR_NODE_START_OFFSET) * SIZEOF_CHAR_NODE;
|
||||
if(uppercaseOnly && node >= (int)'a' && node <= (int)'z') {
|
||||
make_uppercase(chr);
|
||||
}
|
||||
write_char_node(out, fontPath, nodeOffset, chr);
|
||||
}
|
||||
}
|
||||
|
||||
void BuildFonts::write_custom_char_nodes(std::vector<uint8_t> &out, std::string fontPath, int offset, bool uppercaseOnly) {
|
||||
int index = 0;
|
||||
std::vector<std::string> order = get_array_from_json(fontPath, "encoding", "order");
|
||||
for(std::string &chr : order) {
|
||||
if(index >= NUMBER_OF_CHAR_NODES) {
|
||||
std::string fontName = get_string_from_json(fontPath, "name");
|
||||
display_error_and_abort("Too many character nodes in ", fontName, ". The limit is ", NUMBER_OF_CHAR_NODES);
|
||||
}
|
||||
int nodeOffset = offset + (index++ * SIZEOF_CHAR_NODE);
|
||||
write_char_node(out, fontPath, nodeOffset, chr);
|
||||
}
|
||||
// Set the rest of the nodes to show nothing.
|
||||
while(index < NUMBER_OF_CHAR_NODES) {
|
||||
int nodeOffset = offset + (index++ * SIZEOF_CHAR_NODE);
|
||||
out[nodeOffset] = -1;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../common/util.h"
|
||||
//#include "macros.h"
|
||||
|
||||
class BuildFonts {
|
||||
public:
|
||||
BuildFonts(std::string srcPath, std::string dstPath);
|
||||
~BuildFonts();
|
||||
private:
|
||||
void write_ascii_char_nodes(std::vector<uint8_t> &out, std::string srcPath, int offset, bool uppercaseOnly);
|
||||
void write_custom_char_nodes(std::vector<uint8_t> &out, std::string srcPath, int offset, bool uppercaseOnly);
|
||||
};
|
||||
@@ -1,133 +0,0 @@
|
||||
#include "build_gametext.h"
|
||||
|
||||
// Dialog
|
||||
#define END_OF_LINES 0x00
|
||||
#define ACTIVE_LINE 0x01
|
||||
#define CONTINUE 0x0C
|
||||
|
||||
// Textbox
|
||||
#define NEXT_PAGE 0x01
|
||||
|
||||
BuildGameText::BuildGameText(std::string srcPath, std::string dstPath) {
|
||||
std::vector<uint8_t> out;
|
||||
|
||||
|
||||
// TODO: Figure this out!
|
||||
|
||||
std::string textType = get_string_from_json(srcPath, "text-type");
|
||||
if(textType == "Dialog") {
|
||||
// This is temporary until the game text format is figured out
|
||||
int numRawBytes = get_array_length_from_json(srcPath, "raw");
|
||||
|
||||
for(int i = 0; i < numRawBytes; i++) {
|
||||
out.push_back(get_int_from_json(srcPath, "raw", i));
|
||||
}
|
||||
//build_dialog(out, srcPath);
|
||||
} else {
|
||||
build_textbox(out, srcPath);
|
||||
}
|
||||
|
||||
|
||||
while(out.size() % 8 != 0) {
|
||||
out.push_back(0); // Make sure the data is 8-byte aligned.
|
||||
}
|
||||
|
||||
|
||||
write_binary_file(out, dstPath);
|
||||
}
|
||||
|
||||
BuildGameText::~BuildGameText() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
void BuildGameText::build_dialog(std::vector<uint8_t> &out, std::string &srcPath) {
|
||||
int numberOfLines = GET_ARRAY_LENGTH("lines");
|
||||
for(int i = 0; i < numberOfLines; i++) {
|
||||
if(inputJSON["lines"][i].JSONType() == json::JSON::Class::String) {
|
||||
out.push_back(CONTINUE);
|
||||
continue;
|
||||
}
|
||||
if(HAS_KEY("unknown-data", "lines", i)) { // Check if the key "unknown-data" exists.
|
||||
for(int j = 0; j < GET_ARRAY_LENGTH("lines", i, "unknown-data"); j++) {
|
||||
out.push_back(get_int_from_json(srcPath, "lines", i, "unknown-data", j));
|
||||
}
|
||||
break;
|
||||
}
|
||||
out.push_back(ACTIVE_LINE);
|
||||
out.push_back(get_int_from_json(srcPath, "lines", i, "color", "red"));
|
||||
out.push_back(get_int_from_json(srcPath, "lines", i, "color", "green"));
|
||||
out.push_back(get_int_from_json(srcPath, "lines", i, "color", "blue"));
|
||||
out.push_back(get_int_from_json(srcPath, "lines", i, "color", "alpha"));
|
||||
out.push_back(get_int_from_json(srcPath, "lines", i, "font"));
|
||||
out.push_back(get_int_from_json(srcPath, "lines", i, "alignment"));
|
||||
out.push_back((uint8_t)(GET_FLOAT("lines", i, "time") * 5));
|
||||
write_ascii(out, get_string_from_json(srcPath, "lines", i, "text"));
|
||||
//if(i < numberOfLines - 1 && !HAS_KEY("unknown-data", "lines", i + 1)) {
|
||||
// out.push_back(CONTINUE);
|
||||
//}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void write_basic_command(std::vector<uint8_t> &out, uint8_t cmdId, uint8_t value) {
|
||||
out.push_back(cmdId);
|
||||
out.push_back(value);
|
||||
}
|
||||
|
||||
void write_basic_command_4_args(std::vector<uint8_t> &out, uint8_t cmdId, uint8_t a, uint8_t b, uint8_t c, uint8_t d) {
|
||||
out.push_back(cmdId);
|
||||
out.push_back(a);
|
||||
out.push_back(b);
|
||||
out.push_back(c);
|
||||
out.push_back(d);
|
||||
}
|
||||
|
||||
void BuildGameText::build_textbox(std::vector<uint8_t> &out, std::string &srcPath) {
|
||||
int numberOfPages = get_array_length_from_json(srcPath, "pages");
|
||||
for(int page = 0; page < numberOfPages; page++) {
|
||||
int numberOfCommandsInPage = get_array_length_from_json(srcPath, "pages", page);
|
||||
for(int cmd = 0; cmd < numberOfCommandsInPage; cmd++) {
|
||||
std::string cmdType = get_string_from_json(srcPath, "pages", page, cmd, "command");
|
||||
if(cmdType == "Text") {
|
||||
write_ascii(out, get_string_from_json(srcPath, "pages", page, cmd, "value"));
|
||||
} else if(cmdType == "SetFont") {
|
||||
std::string fontId = get_string_from_json(srcPath, "pages", page, cmd, "value");
|
||||
int fontIndex = get_index_of_string_array_value_from_section("ASSET_FONTS", fontId, "fonts-order");
|
||||
if(fontIndex == -1) {
|
||||
display_error_and_abort("Could not find the font \"", fontId, "\" in the \"fonts-order\" array in asset_fonts.json.");
|
||||
}
|
||||
write_basic_command(out, 3, fontIndex);
|
||||
} else if(cmdType == "SetBorder") {
|
||||
write_basic_command_4_args(out, 4,
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "left"),
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "top"),
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "right"),
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "bottom")
|
||||
);
|
||||
} else if(cmdType == "SetColour") {
|
||||
write_basic_command_4_args(out, 5,
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "red"),
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "green"),
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "blue"),
|
||||
get_int_from_json(srcPath, "pages", page, cmd, "value", "alpha")
|
||||
);
|
||||
} else if(cmdType == "SetAlignment") {
|
||||
write_basic_command(out, 6, get_string_from_json(srcPath, "pages", page, cmd, "value") == "center" ? 0 : 4);
|
||||
} else if(cmdType == "Unknown") {
|
||||
write_basic_command(out, 7, get_int_from_json(srcPath, "pages", page, cmd, "value"));
|
||||
} else if(cmdType == "AddVerticalSpacing") {
|
||||
write_basic_command(out, 8, get_int_from_json(srcPath, "pages", page, cmd, "value"));
|
||||
} else if(cmdType == "SetLineHeight") {
|
||||
write_basic_command(out, 9, get_int_from_json(srcPath, "pages", page, cmd, "value"));
|
||||
} else if(cmdType == "SetTimer") {
|
||||
write_basic_command(out, 10, get_int_from_json(srcPath, "pages", page, cmd, "value"));
|
||||
} else if(cmdType == "AllowUserInput") {
|
||||
write_basic_command(out, 11, get_bool_from_json(srcPath, "pages", page, cmd, "value") ? 1 : 0);
|
||||
}
|
||||
}
|
||||
if(page < numberOfPages - 1) {
|
||||
out.push_back(NEXT_PAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../common/util.h"
|
||||
|
||||
class BuildGameText {
|
||||
public:
|
||||
BuildGameText(std::string srcPath, std::string dstPath);
|
||||
~BuildGameText();
|
||||
private:
|
||||
/*
|
||||
void build_dialog(std::vector<uint8_t> &out, std::string &srcPath);
|
||||
*/
|
||||
void build_textbox(std::vector<uint8_t> &out, std::string &srcPath);
|
||||
};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user