News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Need help with CadEditor and FCEUX lua script.  (Read 1038 times)

SomeOldGuy

  • Jr. Member
  • **
  • Posts: 57
  • Game Changer
    • View Profile
Need help with CadEditor and FCEUX lua script.
« on: April 09, 2020, 09:28:48 pm »
Hey Everybody!

I'm trying to get CadEditor to display some newly created tiles for editing levels in Robocop.  The game is supported and from the instructions below it should be simple to do, but no, not for me.  Could someone take a look and tell me what I'm doing wrong.  ;D   

Per Spiiin's instructions to sics:


Quote
CadEditor already supported your romhack (Sonic 5 - Improvement Vol.2 (Nes))
There are configs for this game:
https://github.com/spiiin/CadEditor/tree/master/CadEditor/settings_nes/sonic_the_hedgehog_unl

You need to make only one change - replace dumps of PPU memory and palette files.
For example - for level 1 you need to open 1st level in emulator fceux and run my script:
https://github.com/spiiin/CadEditor/blob/master/Stuff/nes_lua/dump_chr_and_pal/dump_chr_and_pal.lua
It will create files chr.bin and pal.bin.
Next, rename this files to chr1-1(a).bin and pal1-1.bin (as I used in my configs) and replace files in settings_nes/sonic_the_hedgehog_unl directory.
That's all, you can open config in CadEditor with your ROM and edit it

I've tried in 2 versions of FCEUX  and they give different errors (same game and script).  :o

FCEUX 2.2.0 error:


FCEUX 2.2.3 error:


And to be sure I copied it correctly from GitHub, this is Spiiin's lua script:


Any ideas guys?


PolishedTurd

  • Full Member
  • ***
  • Posts: 172
    • View Profile
Re: Need help with CadEditor and FCEUX lua script.
« Reply #1 on: April 09, 2020, 11:41:52 pm »
I don't know enough about Lua or FCEUX to answer definitively, but I might be able to see some breadcrumbs. First of all, they are not the same error. The first error is about the function "readwordunsigned," and the second error refers to an undefined variable "ppu." Since it is a script, the second error suggests that the first error was not a problem for v2.2.3. Otherwise, the error would have occurred earlier on line 11. The problem on line 15 is that it's trying to ask an object named "ppu" to perform a function called "readbyterange," but the interpreter does not know what the "ppu" object is. So, either there is a version of FCEUX where "ppu" is defined such that it can be accessed from anywhere (like the object called "memory" in the script), or the programmer forgot to define what "ppu" is in the context of that function on line 15.

I would try to find another version of FCEUX that has "ppu" defined like "memory" is. Or manually try to do what the script does...

It appears to be copying swaths of memory into separate files in the dumpData function. The first argument of readbyterange appears to be an offset, and the second argument is a number of bytes, both in hexadecimal. You can easily copy and paste from a hex editor based on these offsets and sizes to create the files yourself. If you are not comfortable doing this in a hex editor, reply here and we can help with that.

SomeOldGuy

  • Jr. Member
  • **
  • Posts: 57
  • Game Changer
    • View Profile
Re: Need help with CadEditor and FCEUX lua script.
« Reply #2 on: April 10, 2020, 07:27:21 pm »
Yeah, if you can walk me through the steps to make the chr.bin file manually that would be awesome!  ;D