dgrfactory / spcplay

SNES SPC700 Player + Improved SNESAPU.DLL
https://dgrfactory.jp/spcplay/
GNU General Public License v2.0
142 stars 7 forks source link

spcplay.exe & snesapu.dll build, but snesapu.dll is corrupted (ERROR 129) #68

Closed ZenithMDC closed 4 months ago

ZenithMDC commented 4 months ago

Built as instructed in the Wiki, using:

At first, I tried the latest develop branch. Then I tried tag 2.20.3.8440. Both exhibit the same issue. Comparing (with a hex editor) my snesapu.dll with one from your releases, there are significant differences.

spcplay.exe itself works fine, when I pair it with a build of snesapu.dll from one of your releases. However, I noticed another peculiarity pertaining to both files: the resource files don't resolve their variables correctly. For instance, it says:

Product version $CAP_PRODUCT_VER Copyright Copyright (C) 2003-$YEAR degrade-factory.

Etc...

I was hoping to modify snesapu.dll so that I could listen to the echo channel in isolation, but this is a significant roadblock and I'm really not sure why this is occurring.

dgrfactory commented 4 months ago

@ZenithMDC Thank you for reporting.

1. About variables

These variables are not automatically substituted. If necessary, replace these variables manually: $CAP_FILE_VER, $CAP_PRODUCT_VER, $YEAR

2. About ERROR 129

This is a corruption error, so means a hash do not match. The easiest solution is to skip a hash verification. I pushed a new code in the 'develop' branch that skip verification when built by user. Please download the latest commit and build again.

ZenithMDC commented 4 months ago

Thank you for your quick response! I've just built and tested the latest develop branch and am now receiving a new error code: ERROR 104. So, there's a memory map error. I'm not sure why, with the same build tools, the dll symbols are in different locations than expected. Well, maybe there is an environment issue on my end somewhere?

dgrfactory commented 4 months ago

@ZenithMDC Thank you for trying it right away!

I think don't have a problem with your environment. Depending on the builder state, you may need to adjust memory map.

How to fix:

  1. Open 'SNESAPU.inc' in 'snesapu' folder with a text editor.
  2. Change DSP_ALIGN to 0, 64, 128, or 192 as per the comments, and re-build.
    ;Align Adjustment ----------------------
    ;   Note: Please refer to the map file output during build and adjust the numbers,
    ;     so that the lower 8-bits of the start address of '_mix' are '00'.
    ;    If it is not, the output audio will be noisy because occurred memory-leak.
    ;    The value specified here is 0, 64, 128, or 192.
    DSP_ALIGN   EQU 192                                             ;DSP Object Locate Alignment
                ⬆️
  3. Change this value until the ERROR 104 does not occur.

'SNESAPU.map' file output to the 'Release' folder after built will give you a hint. If the address of _mix ends with 00, it will be successful.

 0002:00123300       _mix                       10130300     DSP.obj
                                                      ⬆️
ZenithMDC commented 4 months ago

Ah, fantastic! I changed that value to 0, rebuilt, and all is working now. Thank you! I recommend adding a note or reminder to the Wiki build instructions about this, for newcomers to this project, since I didn't know to adjust the alignment.

dgrfactory commented 4 months ago

@ZenithMDC Thanks for reporting the build results, also I'm glad to build was successful. I will add a note to the wiki page later.