Skip to content

Commit

Permalink
cache anims at 0x1030000
Browse files Browse the repository at this point in the history
  • Loading branch information
Veslyquix committed Nov 25, 2024
1 parent b6b32c2 commit fabca12
Show file tree
Hide file tree
Showing 11 changed files with 91 additions and 58 deletions.
1 change: 1 addition & 0 deletions .FE7_Installer.event
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ EndOfText:


#ifdef VeslyBuildfile
ORG 0x1030000
#include "gfx/Installer.event"
MESSAGE Graphics end at currentoffset
#endif
Expand Down
Binary file added EventAssembler/none
Binary file not shown.
10 changes: 3 additions & 7 deletions MAKE_fe7cache.cmd → MAKE_animscache.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

@rem defining buildfile config

set "source_rom=%~dp0fe7.gba"
set "source_rom=%~dp0norom.gba"

set "main_event=%~dp0RomBuildfileCache.event"

set "target_rom=%~dp0fe7cache.gba"
set "target_rom=%~dp0anims.dmp"
set "target_sym=%~dp0fe7cache.sym"

@rem defining tools
Expand Down Expand Up @@ -38,11 +38,7 @@ echo Assembling
cd "%base_dir%EventAssembler"
ColorzCore A FE7 "-output:%target_rom%" "-input:%main_event%" --nocash-sym


echo:
echo Generating sym file

echo: | ( "%symcombo%" "%target_sym%" "%target_sym%" "fe7.sym" )
@rem call "MAKE_copyintoanimscache.cmd" noPause

echo:
echo Done!
Expand Down
31 changes: 31 additions & 0 deletions MAKE_copyintoanimscache.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
@echo off
:: Paths
set INPUT_FILE=anims.dmp
set OUTPUT_FILE=animscache.dmp
set OFFSET=0x1030000

copy "%INPUT_FILE%" "%OUTPUT_FILE%"

:: Convert OFFSET from hex to decimal
for /f "tokens=1 delims=" %%i in ('powershell -command "[convert]::ToInt64('%OFFSET%',16)"') do set DEC_OFFSET=%%i

:: Set an optimized block size (e.g., 1/16th of a MB = 65536 bytes)
set BLOCK_SIZE=65536

:: Calculate the number of blocks to skip
set /a SKIP_BLOCKS=%DEC_OFFSET% / %BLOCK_SIZE%

echo Truncating %OUTPUT_FILE% to start at offset %OFFSET% (decimal: %DEC_OFFSET%), using block size %BLOCK_SIZE%...

:: Use dd with larger block size
dd if=%OUTPUT_FILE% of=tmp_%OUTPUT_FILE% bs=%BLOCK_SIZE% skip=%SKIP_BLOCKS%

if %ERRORLEVEL%==0 (
echo Truncation successful. Replacing original file...
move /y tmp_%OUTPUT_FILE% %OUTPUT_FILE%
echo %OUTPUT_FILE% has been updated.
) else (
echo Truncation failed.
del tmp_%OUTPUT_FILE%
)
pause
2 changes: 1 addition & 1 deletion MAKE_fe7.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

@rem defining buildfile config

set "source_rom=%~dp0fe7cache.gba"
set "source_rom=%~dp0fe7.gba"

set "main_event=%~dp0RomBuildfile.event"

Expand Down
5 changes: 3 additions & 2 deletions RomBuildfileCache.event
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#define MAKE_CACHE_ROM
#ifdef VeslyBuildfile
ORG CURRENTOFFSET + 0x30000 // 0.2mb for text
// ORG 0
#include "gfx/Anims/Installer.event"
#endif

Expand All @@ -29,8 +30,8 @@



ALIGN 32
WORD 0 0 0 0 0 0 0 0
// ALIGN 32
// WORD 0 0 0 0 0 0 0 0



Expand Down
Binary file added anims.dmp
Binary file not shown.
Binary file added animscache.dmp
Binary file not shown.
54 changes: 51 additions & 3 deletions gfx/Anims/Installer.event
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,64 @@


// #define MAKE_CACHE_ROM
MESSAGE CURRENTOFFSET

MESSAGE "Installing Animations"
ALIGN 0x10000
NewAnimTable:
MESSAGE CURRENTOFFSET
#ifdef MAKE_CACHE_ROM
#include "Internals.event"
#include "GeneratedInstaller.event"
#else
ORG $600000 + CURRENTOFFSET
// ORG $600000 + CURRENTOFFSET
#incbin "../../animscache.dmp"
#endif
MESSAGE CURRENTOFFSET

#ifndef MAKE_CACHE_ROM


PUSH

#ifdef _FE6_
ORG $4B0F8
POIN NewAnimTable
ORG $4BB4C
POIN NewAnimTable
ORG $4BBD8
POIN NewAnimTable
ORG $4BD38
POIN NewAnimTable
#endif

#ifdef _FE7_
ORG $541F4
POIN NewAnimTable
ORG $54AE8
POIN NewAnimTable
ORG $54B78
POIN NewAnimTable
ORG $54D00
POIN NewAnimTable
#endif

#ifdef _FE8_
ORG $59BD8
POIN NewAnimTable
ORG $5A600
POIN NewAnimTable
ORG $5A694
POIN NewAnimTable
ORG $5A82C
POIN NewAnimTable
ORG $6F6A8
POIN NewAnimTable
ORG $70940
POIN NewAnimTable
ORG $70A60
POIN NewAnimTable
#endif // fe8
POP


#define WepTypeAnim(Animation, typeID) "{ Label: ; ORG Label + (typeID * 4); BYTE typeID 0x01 ; SHORT Animation; ORG Label; }"
Expand Down Expand Up @@ -59,4 +107,4 @@ weaponAnimEnd




#endif
46 changes: 1 addition & 45 deletions gfx/Anims/Internals.event
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,6 @@
#define AnimTableSize 512


PUSH

#ifdef _FE6_
ORG $4B0F8
POIN NewAnimTable
ORG $4BB4C
POIN NewAnimTable
ORG $4BBD8
POIN NewAnimTable
ORG $4BD38
POIN NewAnimTable
#endif

#ifdef _FE7_
ORG $541F4
POIN NewAnimTable
ORG $54AE8
POIN NewAnimTable
ORG $54B78
POIN NewAnimTable
ORG $54D00
POIN NewAnimTable
#endif

#ifdef _FE8_
ORG $59BD8
POIN NewAnimTable
ORG $5A600
POIN NewAnimTable
ORG $5A694
POIN NewAnimTable
ORG $5A82C
POIN NewAnimTable
ORG $6F6A8
POIN NewAnimTable
ORG $70940
POIN NewAnimTable
ORG $70A60
POIN NewAnimTable
#endif // fe8

POP

#ifdef _FE6_
#define DefaultAnimEntry "BYTE 0x61 0x72 0x6D 0x6D 0x5F 0x73 0x70 0x31 0x00 0x00 0x00 0x00;POIN 0x6A5074 0x6A4D84 0x6A47F4 0x6A424C 0x6A41E8; "
#endif // fe6
Expand All @@ -65,8 +22,7 @@ POP
#define DefAnim512 "DefAnim256 DefAnim256"


ALIGN 4
NewAnimTable:

DefAnim512
ORG NewAnimTable

Expand Down
Binary file added new_anims.dmp
Binary file not shown.

0 comments on commit fabca12

Please sign in to comment.