Stephane-D / SGDK

SGDK - A free and open development kit for the Sega Mega Drive
https://www.patreon.com/SGDK
MIT License
1.78k stars 189 forks source link

Fix rescomp build and export array size asm symbol #347

Closed howprice closed 2 months ago

howprice commented 3 months ago

What?

Fixed rescomp so builds (in Eclipse). It looks like the directory paths have been changed (to remove spaces) since the last time this tool was built.

Modified the rescomp source so outputs the binary array size in the generated .s file. For example:

    .align  256
    .global hat1_13k
hat1_13k:
    dc.b    0x00, 0x03, 0xfd, 0x06, 0x00, 0x03, 0x02, 0x00, 0xf3, 0x05, 0x0a, 0xf7, 0x10, 0xf8, 0x14, 0x1a
    dc.b    0xf7, 0x20, 0x1c, 0x2a, 0x01, 0xf2, 0x10, 0xfa, 0xea, 0x07, 0xdf, 0xfb, 0x05, 0xd4, 0xfb, 0x1d
    ...
    dc.b    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
    .global hat1_13k_size
hat1_13k_size = .-hat1_13k

Why?

When PCM audio is played, the size is required by the API. This is provided in the generated .h file, but was not available in the generated .s file. This meant that if the library was used by an assembler project, the required data to play PCM files was not available.

How?

Add Utils::declArrayEnd method and call from Bin::out

What if?

I'm not a Java expert, so hopefully the rebuilt rescomp.jar is compatible. I had to change the Java Compiler compliance level to 1.8 in the Eclipse project settings for commons to allow the jar to run locally.