dot-bob / int2intv

Intellivision rom converter for the Analogue NT mini noir jailbreak.
GNU General Public License v2.0
16 stars 2 forks source link

Suggestion: Functionality to automatically parse memory map from .cfg files #4

Open spspspspspsp opened 3 years ago

spspspspspsp commented 3 years ago

This is a great little tool. Thank you very much. I have been using it to convert homebrew titles to the .intv format. It is easy to use, and the code is easy to understand, even for someone like myself who has not used c++ in ages.

To convert homebrew titles, I have been looking at the .cfg files and manually converting the memory map to the format used by int2intv. It is a simple process, but it takes some time for me to calculate the ranges in hexidecimal.

A nice feature would be if .cfg files could be passed as a parameter, and then the memory map could be automatically extracted.

So far almost every homebrew title I have looked at has had a different map, so the conversion is slow going.

Also, Aardvark has five banks. I modified my local copy to have an extra bank.

int2intv_rev.zip

SoulSwordStrike commented 1 year ago

Didn't know if you're still on github @spspspspspsp , but I need help converting a homebrew game to intv. Thanks.

spspspspspsp commented 1 year ago

You have to modify the script to convert IntelliVania (I saw your other post).

First, change the arrays in the header. I use the following, because there is one homebrew that uses 13 banks.

unsigned int MapAddress[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0}; unsigned int DataSize[13] = {0,0,0,0,0,0,0,0,0,0,0,0,0};

For the demo, you need the following case:

case XX: // IntelliVania (Demo) MapAddress[0] = 0x4800; DataSize[0] = 0x0500; MapAddress[1] = 0x5000; DataSize[1] = 0x1E00; MapAddress[2] = 0x7100; DataSize[2] = 0x1200; MapAddress[3] = 0xA000; DataSize[3] = 0x0E00; MapAddress[4] = 0xC000; DataSize[4] = 0x2200; break;

If you bought the ROM, then use the following:

case YY: // IntelliVania (Full) MapAddress[0] = 0x2100; DataSize[0] = 0x0F00; MapAddress[1] = 0x4800; DataSize[1] = 0x2800; MapAddress[2] = 0x7100; DataSize[2] = 0x0F00; MapAddress[3] = 0x8800; DataSize[3] = 0x2F00; MapAddress[4] = 0xC800; DataSize[4] = 0x3800; break;

You can get these address and data sizes from bin+cfg ROMs. There is a helper program included with jzintv that will convert .rom files to bin+cfg format. The bank information is in the cfg files, and the .bin file is what you convert to .intv.

The only homebrew that won't run are programs that utilize JLP. A few programs define RAM banks too, and supposedly they run, but I've not had much luck.

On Tue, Nov 15, 2022 at 6:10 PM SoulSwordStrike @.***> wrote:

Didn't know if you're still on github @spspspspspsp https://github.com/spspspspspsp , but I need help converting a homebrew game to intv. Thanks.

— Reply to this email directly, view it on GitHub https://github.com/dot-bob/int2intv/issues/4#issuecomment-1315991789, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASBWY76IL4LFEG53QETWNOTWIQJ6JANCNFSM4WL5FRIQ . You are receiving this because you were mentioned.Message ID: @.***>

SoulSwordStrike commented 1 year ago

I didn't have much luck but maybe I am doing something wrong or my files need different values? (Im not really a programmer but I was able to recompile a new int2intv) Need some help to figure out what I'm doing wrong, maybe you could provide me with a different cpp to compile or a compiled exe using these values. edited: (forgot to mention the problem I'm having is I'm getting a black screen when I load the converted intv, so I'm almost certainly doing something wrong, or my files need different values)

(This is regarding the full game of intellivania) Intellivision collector gave me a separate bin+cfg for the game when I e-mailed them and asked for help This is contained in it [mapping] $0000 - $1FFF = $5000 $2000 - $2FFF = $D000 $3000 - $3FFF = $F000

If I use rom2bin to convert the rom they gave me on purchase I see this in the cfg [mapping] $0000 - $0EFF = $2100 $0F00 - $36FF = $4800 $3700 - $45FF = $7100 $4600 - $74FF = $8800 $7500 - $ACFF = $C800

[vars] ecs = 1 voice = 0 intv2 = 1 kc_compat = 1 tv_compat = 1 lto_mapper = 0 jlp_accel = 0 jlp_flash = 0

SoulSwordStrike commented 1 year ago

@spspspspspsp sorry to ping/bump this issue I believe I'm close to getting the game to work, but I think my files may need different map address and data size values than the ones you posted, or I am somehow missing something or messing up the script. Unfortunately I do not know how to convert the cfg values to the values expected by the converter. I have posted the contents of both of the cfg files I have in the post above for reference. Thank you in advance for any assistance.

spspspspspsp commented 1 year ago

The values I gave you are correct. They match your .cfg file. You are probably not processing the last memory block in your recompiled code.

You need to expand the main loop of the program to accommodate the ROM, by adding the following, I think:

// fifth block if(readSize > DataSize[4]) headerSize = DataSize[4]; else headerSize = readSize;

 readSize -= headerSize;

//write header
outputFile.write((const char *) &MapAddress[4], sizeof(unsigned int));

// write address outputFile.write((const char *) &headerSize, sizeof(unsigned int)); // write size

//write data
while(inputFile.read(inputBuffer, wordsize))
{
    outputFile.write(inputBuffer, wordsize);
    if(--headerSize == 0)
        break;
}

if(readSize == 0)
    goto endblock;

On Thu, Nov 17, 2022 at 8:06 AM SoulSwordStrike @.***> wrote:

@spspspspspsp https://github.com/spspspspspsp sorry to ping/bump this issue I believe I'm close to getting the game to work, but I think my files may need different map address and data size values than the ones you posted, or I am somehow missing something or messing up the script. Unfortunately I do not know how to convert the cfg values to the values expected by the converter. I have posted the contents of both of the cfg files I have in the post above for reference. Thank you in advance for any assistance.

— Reply to this email directly, view it on GitHub https://github.com/dot-bob/int2intv/issues/4#issuecomment-1318606556, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASBWY77S6E36EWMKQQRUTQDWIYUTZANCNFSM4WL5FRIQ . You are receiving this because you were mentioned.Message ID: @.***>

spspspspspsp commented 1 year ago

Just modify the code I posted last year with the InvelliVania memory information under the Aardvark entry in the code. That already has 5 banks.

Again, this is the correct memory info: MapAddress[0] = 0x2100; DataSize[0] = 0x0F00; MapAddress[1] = 0x4800; DataSize[1] = 0x2800; MapAddress[2] = 0x7100; DataSize[2] = 0x0F00; MapAddress[3] = 0x8800; DataSize[3] = 0x2F00; MapAddress[4] = 0xC800; DataSize[4] = 0x3800;

On Thu, Nov 17, 2022 at 12:06 PM James Split @.***> wrote:

The values I gave you are correct. They match your .cfg file. You are probably not processing the last memory block in your recompiled code.

You need to expand the main loop of the program to accommodate the ROM, by adding the following, I think:

// fifth block if(readSize > DataSize[4]) headerSize = DataSize[4]; else headerSize = readSize;

 readSize -= headerSize;

//write header
outputFile.write((const char *) &MapAddress[4], sizeof(unsigned int));

// write address outputFile.write((const char *) &headerSize, sizeof(unsigned int)); // write size

//write data
while(inputFile.read(inputBuffer, wordsize))
{
    outputFile.write(inputBuffer, wordsize);
    if(--headerSize == 0)
        break;
}

if(readSize == 0)
    goto endblock;

On Thu, Nov 17, 2022 at 8:06 AM SoulSwordStrike @.***> wrote:

@spspspspspsp https://github.com/spspspspspsp sorry to ping/bump this issue I believe I'm close to getting the game to work, but I think my files may need different map address and data size values than the ones you posted, or I am somehow missing something or messing up the script. Unfortunately I do not know how to convert the cfg values to the values expected by the converter. I have posted the contents of both of the cfg files I have in the post above for reference. Thank you in advance for any assistance.

— Reply to this email directly, view it on GitHub https://github.com/dot-bob/int2intv/issues/4#issuecomment-1318606556, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASBWY77S6E36EWMKQQRUTQDWIYUTZANCNFSM4WL5FRIQ . You are receiving this because you were mentioned.Message ID: @.***>

SoulSwordStrike commented 1 year ago

Thank you so much! Yes I was messing up something in the code. This time I simply edited the Aardvark entry in the code file you posted previously and it worked. Thank you again for helping me on this.

mholzinger commented 1 year ago

Edit: I Solved my issue - I was attempting to convert the rom instead of the bin to intv2.

For the curious the correct md5 will be:

md5sum Intellivania_Final.intv
a4014094369df9ca39ea8d9bae924086  Intellivania_Final.intv
spspspspspsp commented 1 year ago

Is the rom in bin/cfg format?

On Wednesday, July 26, 2023, Mike Holzinger @.***> wrote:

Hi all!

I just pulled down and compiled this code and patched the Intellivania Retail rom that I picked up today, I got the md5sum of:

39ec6989742d909cc628fd0348f1512e

I'm trying this out on my Analogue Pocket Intellivision core (we know it's the same one on the NT Noire) and I'm not getting this loading up at all.

Any suggestions other than swapping in the memory mapping for the retail rom into the spot for Aardvark and case:10 in the code?

— Reply to this email directly, view it on GitHub https://github.com/dot-bob/int2intv/issues/4#issuecomment-1652834847, or unsubscribe https://github.com/notifications/unsubscribe-auth/ASBWY72XOSSYB5U64M3CZO3XSHJVLANCNFSM4WL5FRIQ . You are receiving this because you were mentioned.Message ID: @.***>

mholzinger commented 1 year ago

That was my issue!

I'm currently attempting to write a tool that converts the cfg maps to values to use in this program but struggling to understand how the following mapping works.

Using Princess Quest as an example:

From the cfg file generated by rom2bin, we can see the following map:

[mapping]
$0000 - $0EFF = $2100
$0F00 - $36FF = $4800
$3700 - $55FF = $A000
$5600 - $94FF = $C100

But I'm still uncertain how the Satasize is derived between the starting memory map and the second value.

$0000 - $0EFF

That should produce $0F00 which would be the Datasize and I'm still stuck on how to arrive at that value.

I've been trying to follow along with the docs here:

https://github.com/SmokeMonsterPacks/Nt-Mini-Noir-Jailbreak#intellivision-core-release-notes

    MapAddress[0] = 0x2100;
    DataSize[0] = 0x0F00;

    MapAddress[1] = 0x4800;
    DataSize[1] = 0x2800;

    MapAddress[2] = 0xA000;
    DataSize[2] = 0x1F00;

    MapAddress[3] = 0xC100;
    DataSize[3] = 0x3F00;

Any pointers on how I can generate those values so I can program a feature?

spspspspspsp commented 1 year ago

$2100 is the address.

$0F00 is the data size.

To arrive at that number, subtract the two values on the left size (reversing the order in which they are presented) of the mapping in the cfg file, then add "1" in a hex calculator.

So for the address $2100 this would be: $0EFF-$0000+1. This equals $0F00.

On Thu, Jul 27, 2023 at 10:35 AM Mike Holzinger @.***> wrote:

That was my issue!

I'm currently attempting to write a tool that converts the cfg maps to values to use in this program but struggling to understand how the following mapping works.

Using Princess Quest as an example:

From the cfg file generated by rom2bin, we can see the following map:

[mapping] $0000 - $0EFF = $2100 $0F00 - $36FF = $4800 $3700 - $55FF = $A000 $5600 - $94FF = $C100

But I'm still uncertain how the Satasize is derived between the starting memory map and the second value.

$0000 - $0EFF

That should produce $0F00 which would be the Datasize and I'm still stuck on how to arrive at that value.

I've been trying to follow along with the docs here:

https://github.com/SmokeMonsterPacks/Nt-Mini-Noir-Jailbreak#intellivision-core-release-notes

MapAddress[0] = 0x2100;
DataSize[0] = 0x0F00;

MapAddress[1] = 0x4800;
DataSize[1] = 0x2800;

MapAddress[2] = 0xA000;
DataSize[2] = 0x1F00;

MapAddress[3] = 0xC100;
DataSize[3] = 0x3F00;

Any pointers on how I can generate those values so I can program a feature?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

espiox commented 9 months ago

Has anyone been able to convert any homebrew games with more than 7 banks? I've expanded the script to account for it and triple checked that I've entered the correct values, but when I try to load it up in the Pocket core, I get a Chip32: Unaligned Value error.

Also, did anyone work out what to do with games that have a RAM bank specified in their CFG file? All those ones I've converted have had errors.