It is currently Sun Dec 17, 2017 7:12 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 571 posts ]  Go to page Previous  1 ... 31, 32, 33, 34, 35, 36, 37 ... 39  Next
Author Message
PostPosted: Wed Jun 07, 2017 10:16 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6535
Location: Seattle
werewolfslayr925 wrote:
libusb0-dll:err [control_msg] sending control message failed, win error: A device attached to the system is not functioning.
That message insinuates that the microcontroller has crashed, or is in an infinite loop, or is drawing more power than it's allowed to.

Ganbare Goemon Gaiden is an odd duck among the VRC2 carts, since it adds extra hardware to add support for RAM. Have you tried dumping it as though it were VRC4?


Top
 Profile  
 
PostPosted: Wed Jun 07, 2017 10:47 am 
Offline

Joined: Sat Oct 02, 2010 5:49 pm
Posts: 19
Quote:
Ganbare Goemon Gaiden is an odd duck among the VRC2 carts, since it adds extra hardware to add support for RAM. Have you tried dumping it as though it were VRC4?


I remember trying that because I saw that the VRC2 script pointed to something related to VRC4 anyway. I don't remember if it gave the same error or if it gave me a specific error for a particular line in the script. I'll have to wait to get home to find out.

If it does give the same error as mentioned above (libusb0 etc.), what would I need to do to dump it?


Top
 Profile  
 
PostPosted: Wed Jun 07, 2017 10:59 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6535
Location: Seattle
No idea.

Given that you do get through 15/16 of the PRG, it seems safe to assume that what's going wrong is somewhere in the last three lines
Code:
function vrc4_cpu_dump(d, pagesize, banksize, r0, r1)
{
   local a2 = 1 << r1;
   cpu_write(d, 0x9000 | a2, 0);
   for(local i = 0; i < pagesize - 2; i += 2){
      cpu_write(d, 0x8000, i);
      cpu_write(d, 0xa000, i | 1);
      cpu_read(d, 0x8000, banksize * 2);
   }
   cpu_write(d, 0x9000 | a2, 0x02); ←
   cpu_write(d, 0x8000, 0x1e); ←
   cpu_read(d, 0xc000, banksize * 2); ←
}


Honestly, I don't know why Naruko decided to special case reading the last page, instead of just making it part of the main loop, i.e.:
Code:
function vrc4_cpu_dump(d, pagesize, banksize, r0, r1)
{
   cpu_write(d, 0x90ff, 0);
   for(local i = 0; i < pagesize; i += 2){
      cpu_write(d, 0x8000, i);
      cpu_write(d, 0xa000, i | 1);
      cpu_read(d, 0x8000, banksize * 2);
   }
}


Top
 Profile  
 
PostPosted: Wed Jun 07, 2017 7:14 pm 
Offline

Joined: Sat Oct 02, 2010 5:49 pm
Posts: 19
@lidnariq:

OMIGOSH! Yes! Now it's completing the process! I had to throw in one more "}", but that did the trick to make the code complete!

...

However, it isn't yielding a proper dump. I'm getting the following output:

Code:
Program ROM: size 0x020000, crc32 0xcaf8912c
Charcter ROM: size 0x020000, crc32 0x8a0691fd


The output should be different according to Bootgod's database: http://bootgod.dyndns.org:7777/profile.php?id=3823

Any ideas?


Top
 Profile  
 
PostPosted: Wed Jun 07, 2017 7:23 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5899
Location: Canada
werewolfslayr925 wrote:
Code:
Program ROM: size 0x020000, crc32 0xcaf8912c
Charcter ROM: size 0x020000, crc32 0x8a0691fd


The output should be different according to Bootgod's database: http://bootgod.dyndns.org:7777/profile.php?id=3823

Any ideas?

Bootgod's database says they're both 256k (0x40000) chips, not 128k (0x20000).


Top
 Profile  
 
PostPosted: Wed Jun 07, 2017 7:24 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6535
Location: Seattle
All other VRC2-using games other than GGG1 max out at 128 KiB, so you might need to change the vrc2a/vrc2b header line to scan more total bytes.


Top
 Profile  
 
PostPosted: Wed Jun 07, 2017 8:15 pm 
Offline

Joined: Sat Oct 02, 2010 5:49 pm
Posts: 19
rainwarrior wrote:
Bootgod's database says they're both 256k (0x40000) chips, not 128k (0x20000).


lidnariq wrote:
All other VRC2-using games other than GGG1 max out at 128 KiB, so you might need to change the vrc2a/vrc2b header line to scan more total bytes.


Oof, duh. Okay, so

@lidnariq: I'm not sure which part of the code you mean. Do I change this:

Code:
board <- {
   mappernum = 25, vram_mirrorfind = false, ppu_ramfind = false,
   cpu_rom = {
      size_base = 1 * mega, size_max = 1 * mega,
      banksize = 0x2000
   },
   ppu_rom = {
      size_base = 1 * mega, size_max = 1 * mega,
      banksize = 0x2000 / 8
   }
};


to this:

Code:
board <- {
   mappernum = 25, vram_mirrorfind = false, ppu_ramfind = false,
   cpu_rom = {
      size_base = 1 * mega, size_max = 1 * mega,
      banksize = 0x4000
   },
   ppu_rom = {
      size_base = 1 * mega, size_max = 1 * mega,
      banksize = 0x4000 / 8
   }
};


because I tried that and it gave me a whole mess of errors. Please forgive me, I'm not sure what you mean by the header line. What part of the code should I change and how?


Top
 Profile  
 
PostPosted: Wed Jun 07, 2017 8:20 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19353
Location: NE Indiana, USA (NTSC)
Try instead changing each 1 * mega to 2 * mega.


Top
 Profile  
 
PostPosted: Wed Jun 07, 2017 8:22 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5899
Location: Canada
1 megabit = 128k
2 megabits = 256k

A megabit is an 8 times larger number than a megabyte of the same size.


Top
 Profile  
 
PostPosted: Wed Jun 07, 2017 8:42 pm 
Offline

Joined: Sat Oct 02, 2010 5:49 pm
Posts: 19
tepples wrote:
Try instead changing each 1 * mega to 2 * mega.


I thought that that might be the issue, and I tried that too, but to no avail. It's still giving me the following errors:

Code:
data range must be 0x000000 to 0x0000ff

CALLSTACK
*FUNCTION [vrc2a_ppubank_set()] vrc2gg.ad line [152]
*FUNCTION [ppu_dump()] vrc2gg.ad line [164]
*FUNCTION [dump()] dumpcore.nut line [45]

LOCALS
[a3] 3
[a2] 1
[a1] 1
[r1] 0
[r0] 1
[j] 129
[i] 128
[addr] 45056
[a3] USERPOINTER
[this] TABLE
[i] 128
[r1] 0
[r0] 1
[banksize] 1024
[pagesize] 256
[d] USERPOINTER
[this] TABLE
[ppu_dumpsize]262144
[cpu_dumpsize] 262144
[ppuarea_memory] 0
[vram] 0
[increase_ppu] 2
[increase_cpu] 1
[mappernum] 25
[script] "vrc2gg.ad"
[d] USERPOINTER
[this] TABLE


For reference, here's the code I've got so far:

Code:
/*
VRCII A0,A1 swap + charcter ROM address bus shiftx1
051744 jumper G?
VRC-CPU|databus
A0 - A1|A0: xxxx210x
A1 - A0|A1: xxxx6543
VRC-CHRCTER ROM
A11-A17 = A10-A16
*/
board <- {
   mappernum = 25, vram_mirrorfind = false, ppu_ramfind = false,
   cpu_rom = {
      size_base = 2 * mega, size_max = 2 * mega,
      banksize = 0x2000
   },
   ppu_rom = {
      size_base = 2 * mega, size_max = 2 * mega,
      banksize = 0x2000 / 8
   }
};
function vrc4_cpu_dump(d, pagesize, banksize, r0, r1)
{
   cpu_write(d, 0x90ff, 0);
   for(local i = 0; i < pagesize; i += 2)
   {
      cpu_write(d, 0x8000, i);
      cpu_write(d, 0xa000, i | 1);
      cpu_read(d, 0x8000, banksize * 2);
   }
}
function ppu_bank_set(d, addr, i, j, r0, r1)

{
   local a1 = (1 << r0);

   local a2 = (1 << r1);

   local a3 = a1 | a2;

   cpu_write(d, addr | a1, i >> 4);

   cpu_write(d, addr, i & 0xf);
   cpu_write(d, addr | a3, j >> 4);

   cpu_write(d, addr | a2, j & 0xf);

}

function vrc4_ppu_dump(d, pagesize, banksize, r0, r1)

{

   for(local i = 0; i < pagesize; i += 8)
   {

      ppu_bank_set(d, 0xb000, i | 0, i | 1, r0, r1);

      ppu_bank_set(d, 0xc000, i | 2, i | 3, r0, r1);

      ppu_bank_set(d, 0xd000, i | 4, i | 5, r0, r1);

      ppu_bank_set(d, 0xe000, i | 6, i | 7, r0, r1);

      ppu_read(d, 0x0000, banksize * 8);

   }

}


function vrc4_program_initialize(d, cpu_banksize, ppu_banksize, r0, r1)

{

   local a2 = 1 << r1;

   cpu_write(d, 0x9000 | a2, 0);

   cpu_write(d, 0x8000, 1);

   cpu_write(d, 0xa000, 0);


   cpu_command(d, 0, 0xa000, cpu_banksize);

   cpu_command(d, 0x2aaa, 0x8000, cpu_banksize);

   cpu_command(d, 0x5555, 0xc000, cpu_banksize);

   
ppu_bank_set(d, 0xb000, 0x0a, 0x15, r0, r1);

   ppu_bank_set(d, 0xc000, 0x00, 0x00, r0, r1);

   ppu_command(d, 0, 0x0800, ppu_banksize);

   ppu_command(d, 0x2aaa, 0x0000, ppu_banksize);

   ppu_command(d, 0x5555, 0x0400, ppu_banksize);

}


function cpu_transfer(d, start, end, cpu_banksize)

{

   for(local i = start; i < end - 2; i++)
   {

      cpu_write(d, 0xa000, i);

      cpu_program(d, 0xa000, cpu_banksize);

   }

   cpu_program(d, 0xc000, cpu_banksize * 2);

}


function vrc4_ppu_transfer(d, start, end, ppu_banksize, r0, r1)

{

   for(local i = start; i < end; i += 4)
   {

      ppu_bank_set(d, 0xd000, i | 0, i | 1, r0, r1);

      ppu_bank_set(d, 0xe000, i | 2, i | 3, r0, r1);

      ppu_program(d, 0x1000, ppu_banksize * 4);

   }

}

function cpu_dump(d, pagesize, banksize)
{
   vrc4_cpu_dump(d, pagesize, banksize, 1, 0);
}


function vrc2a_ppubank_set(d, addr, i, j, r0, r1)
{
   local a1 = 1 << r0;
   local a2 = 1 << r1;
   local a3 = a1|a2;

   cpu_write(d, addr | a1, i >> 3);
   cpu_write(d, addr, i << 1);
   cpu_write(d, addr | a3, j >> 3);
   cpu_write(d, addr | a2, j << 1);
}

function ppu_dump(d, pagesize, banksize)
{
   local r0 = 1;
   local r1 = 0;

   for(local i = 0; i < pagesize; i += 8)
   {
      vrc2a_ppubank_set(d, 0xb000, i | 0, i | 1, r0, r1);
      vrc2a_ppubank_set(d, 0xc000, i | 2, i | 3, r0, r1);
      vrc2a_ppubank_set(d, 0xd000, i | 4, i | 5, r0, r1);
      vrc2a_ppubank_set(d, 0xe000, i | 6, i | 7, r0, r1);
      ppu_read(d, 0x0000, banksize * 8);
   }
}


Top
 Profile  
 
PostPosted: Wed Jun 07, 2017 8:50 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6535
Location: Seattle
werewolfslayr925 wrote:
Code:
   cpu_write(d, addr | a1, i >> 3);
   cpu_write(d, addr, i << 1);
   cpu_write(d, addr | a3, j >> 3);
   cpu_write(d, addr | a2, j << 1);
Uh, what?

Oh, I see, you adapted the VRC2A code. Yeah, this is the VRC2A chr banking, not the VRC4b-style banking used by GGG1.

Replace those parameters with i>>4 ; i;j>>4; j


Top
 Profile  
 
PostPosted: Wed Jun 07, 2017 9:02 pm 
Offline

Joined: Sat Oct 02, 2010 5:49 pm
Posts: 19
OMIGOSH! IT WORKED!!

The Program ROM is a bit off, but it's yielding a working ROM! What's more, I needed this so I could test a translation patch for the game (for someone else...). So fyi, that should be ready soon if anyone is interested!

Thank you so much, tepples, lidnariq, and rainwarrior! Is there a master list of anago scripts to which I can contribute the script that successfully dumped the game? Should I contact Arantius so he can add it to his github or something?

EDIT:
Okay, so the patch doesn't seem to like the slightly off ROM too much and some of the text sprites are in very weird places. What would I need to change in the script to get a perfect dump of the ROM?

The results that the script yields are as follows:

Code:
Program ROM: size 0x040000, crc32 0x825cba9e
Charcter ROM: size 0x040000, crc32 0x99a563fe


Top
 Profile  
 
PostPosted: Wed Jun 07, 2017 9:30 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19353
Location: NE Indiana, USA (NTSC)
I guess you could join GitHub, fork the project, add your script, and submit a pull request.


Top
 Profile  
 
PostPosted: Wed Jun 07, 2017 10:01 pm 
Offline

Joined: Sat Oct 02, 2010 5:49 pm
Posts: 19
I wanna make sure I get a clean copy of the ROM first, though. According to Bootgod's database, the CPU of the dump I got is slightly off

Code:
Program ROM: size 0x040000, crc32 0x825cba9e


VS

0x8360FA88

What can I change in the code to fix that?


Top
 Profile  
 
PostPosted: Wed Jun 07, 2017 10:11 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5899
Location: Canada
You don't directly change the code to make the CRC match. The CRC is just a signature of the data you dumped.

If the dump for Bootgod was different at all from your cartridge, the CRC will be different.

If you incorrectly dumped, then there is something you might change in the code, but your goal should be getting an accurate dump of your cart, not matching a CRC. Can you run the dumped ROM in an emulator?

If you have a copy of the dump Bootgod used downloaded from somewhere (GoodNES set or something?), you can also use some binary compare tool to check that ROM against yours to see what's different, which could give a better idea of whether your dump is correct or not.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 571 posts ]  Go to page Previous  1 ... 31, 32, 33, 34, 35, 36, 37 ... 39  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: bazza and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group