Author Topic: NeoTextROMFix code  (Read 14278 times)

Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
NeoTextROMFix code
« on: November 24, 2004, 07:29:37 PM »
If anyone needs this here the whole code I use by now...
EDIT: Fixed the code, the old one didn't do anything to the svcchaos/svcnd texts, now it's ok
in neogeo.h:
add this after // neo_run.cpp
Code: [Select]
extern int nNeoTextROMFixType;in neo_run.cpp
add this after #include "neogeo.h"
Code: [Select]
#include "bitswap.h"find:
Code: [Select]
int NeoSRAMProtection = -1;add this after:
Code: [Select]
int nNeoTextROMFixType = 0; // Text fix for games that have TextBankswitchfind:
Code: [Select]
BurnLoadRom(NeoTextROM + 0x020000, pInfo->nTextOffset, 1);add this after
Code: [Select]
/* Original code for MAME by fataku */
if (nNeoTextROMFixType == 1) {
       unsigned char* srom = NeoTextROM+0x20000;
       for (int i=0;i<0x20000;i++) {
        srom[i]=BITSWAP08(srom[i],3,2,4,5,1,6,0,7);
       }
}
/* Original code from mame traduced by FerchogtX */
if (nNeoTextROMFixType == 2) {
/* Descrambling S1 by FerchogtX, bassed on DorriGa's code */
unsigned char* srom = NeoTextROM+0x20000;
unsigned char* dst = (unsigned char*)malloc(0x20000);
memcpy( dst+0x00000, srom+0x10000, 0x10000 );
memcpy( dst+0x10000, srom+0x00000, 0x10000 );
memcpy( srom, dst, 0x20000 );
free(dst);
}
/* Thanks also to HappyASR for the info */
if (nNeoTextROMFixType == 3) {
unsigned char* srom = NeoTextROM+0x20000;
unsigned char* dst = (unsigned char*)malloc(0x20000);
if (dst)
{
memcpy(dst,srom,0x20000);
// descrambling the S1 by dorriGa
for (int j=0;j<0x20000 ; j+=0x000010)
{
memcpy(srom+j, dst+j+0x000008,8);
memcpy(srom+j+0x000008, dst+j,8);
}
}
free(dst);
}
/* Thanks to Badzou for the info */
if (nNeoTextROMFixType == 4) {
/* Descrambling S1 by dorriga */
unsigned char* srom = NeoTextROM+0x20000;
unsigned char* dst = (unsigned char*)malloc(0x80000);
memcpy( dst+0x00000, srom+0x60000, 0x20000 );
memcpy( dst+0x20000, srom+0x40000, 0x20000 );
memcpy( dst+0x40000, srom+0x20000, 0x20000 );
memcpy( dst+0x60000, srom+0x00000, 0x20000 );
memcpy( srom, dst, 0x80000 );
free(dst);
}
// Converted by Jimmy_Page (www.neofighters.com)
if (nNeoTextROMFixType == 5) {
       unsigned char* srom = NeoTextROM+0x20000;
       for (int i=0;i<0x20000;i++) {
        srom[i]=BITSWAP08(srom[i],7,6,0,4,3,2,1,5);
       }
}
find:
Code: [Select]
NeoExtractSData(NeoSpriteROM, NeoTextROM + 0x020000, nSpriteSize, nNeoTextROMSize);add this after:
Code: [Select]
// Original convertion by IQ_132 (This is for svcchaos and clones)
if (nNeoTextROMFixType == 6) {
unsigned char* srom = NeoTextROM+0x20000;
for( int i=0;i<nNeoTextROMSize;i++ ){
srom[i]=BITSWAP08(srom[i]^0xd2,4,0,7,2,5,1,6,3);
}
}
find NeoExit()
add this after nNeoSRAMProtection = -1;
Code: [Select]
nNeoTextROMFixType = 0; // Turns off Text fix when you quit a gameDon't forget to replace all nTextBankswitch references with this new name:
Code: [Select]
nNeoTextROMFixTypeif you have the old names...
See ya!!!!!!! :D
P.D. here a reference for the values:
1 is for kf2k1pla
2 is for svcboot, svcplusa, ms5plusa
3 is for ms5plus, kof2003b, svcplus, samsh5bl, kf97plsa
4 is for games that uses a 512 KB s1 rom to simulate certain effects, this is not realy a valid init, when we can get working kof2003 (PCB) and svcchaos and clones, this will be deleted, games that uses this value: svcboota, svcplusb, svcsplsa, kof2k3ba, kof2k4xa.
5 is for svcsplus, kof2k3up (thanks james33)
6 is for svcnd
« Last Edit: May 10, 2005, 12:47:05 PM by iq_132 »

Good and evil co-exist because of the balance, lies are not part of it...

FB Alpha Plus! site infos updated, see the latest info clicking on my profile link...

Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
NeoTextROMFix code
« Reply #1 on: November 24, 2004, 08:51:42 PM »
5 should also work for King of Fighters 2004 ultra Plus
IQ Forum Member

Offline Xeon

  • Newbies
  • *
  • Posts: 45
  • Karma: +0/-0
  • Member
NeoTextROMFix code
« Reply #2 on: November 24, 2004, 11:30:15 PM »
okay thanks peeps, time to update code :)

Offline Accosta_m

  • Newbies
  • *
  • Posts: 15
  • Karma: +0/-0
  • The Ghost Gundam
NeoTextROMFix code
« Reply #3 on: November 26, 2004, 05:18:46 PM »
Very Thanks Fercho  :D
:D     :cool:     :eek:     ;)     :p

Offline Shoometsu

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
  • I finally have an avatar XD
NeoTextROMFix code
« Reply #4 on: November 27, 2004, 07:58:01 AM »
Quote
Don't forget to replace all nTextBankswitch references with this new name:

Code:

Code: [Select]
nNeoTextROMFixType

Where do I find these references

 :confused:
« Last Edit: May 10, 2005, 12:47:15 PM by iq_132 »
<- Who are you?

Offline iq_132

  • Administrator
  • *****
  • Posts: 3724
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
NeoTextROMFix code
« Reply #5 on: November 27, 2004, 08:05:02 AM »
He means that if you have the old "nTextBankswitch" code in your build, go through your source files and do a "search and replace" -- replacing "nTextBankswitch" with "nNeoTextROMFixType"

If you don't have the nTextBankswitch code in your build, don't worry about it ;)


Offline Shoometsu

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
  • I finally have an avatar XD
NeoTextROMFix code
« Reply #6 on: November 27, 2004, 10:34:01 AM »
I've discovered that I don't have this (thanks ultraedit32), search in each file for that should be a pain in the behind, no one reference to nTextBankswitch in any file here XD

one more thing: in the explanation begining where

find in neo_run.cpp:

Code: [Select]
int NeoSRAMProtection = -1;
I've found only

Code: [Select]
int nNeoSRAMProtection = -1;
I don't know if I'm doing something wrog, but " did the compilation without any error messages.
« Last Edit: May 10, 2005, 12:47:44 PM by iq_132 »
<- Who are you?

Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
NeoTextROMFix code
« Reply #7 on: November 27, 2004, 10:40:33 AM »
Good old Notepad does the job for me . :D
IQ Forum Member

Offline Shoometsu

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
  • I finally have an avatar XD
NeoTextROMFix code
« Reply #8 on: November 27, 2004, 11:17:22 AM »
Quote from: James33
Good old Notepad does the job for me . :D


Sure, i like notepad too, but I don't know where could be the reference, so utraedit searched in each source file by itself, I didn't need to open each file in notepad XD lot of time saved
<- Who are you?

Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
NeoTextROMFix code
« Reply #9 on: November 28, 2004, 01:17:19 AM »
Don't forget that Ultra Edit adds auto spaces when needed... very usefull :P
Better to use UE... you can also undo some things that you do if are wrong...
See ya!!!!! :D
P.D. and adds colors like the Visual Studio editor XD

Good and evil co-exist because of the balance, lies are not part of it...

FB Alpha Plus! site infos updated, see the latest info clicking on my profile link...

Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
NeoTextROMFix code
« Reply #10 on: December 07, 2004, 07:42:33 PM »
Add this after the case 5:
for ct2003sp s1 ROM
Code: [Select]
if (nNeoTextROMFixType = 7) {
unsigned char *rom = NeoTextROM+0x20000;
unsigned char *buf = (unsigned char*)malloc( 0x40000 );
int i, ofst;

memcpy( buf, rom, 0x40000 );

for( i = 0; i < 0x40000; i++ ){
ofst = BITSWAP24( (i & 0x1ffff),23,22,21,20,19,18,17,3,
0,1,4,2,13,14,16,15,5,6,11,10,9,8,7,12 );
ofst += (i >> 17) << 17;
rom[ i ] = buf[ ofst ];
}

memcpy( buf, rom, 0x40000 );

memcpy( &rom[ 0x08000 ], &buf[ 0x10000 ], 0x8000 );
memcpy( &rom[ 0x10000 ], &buf[ 0x08000 ], 0x8000 );
memcpy( &rom[ 0x28000 ], &buf[ 0x30000 ], 0x8000 );
memcpy( &rom[ 0x30000 ], &buf[ 0x28000 ], 0x8000 );

free( buf );
}
maybe this works, i had to remove all not declared functions on it, to see the original driver check on the HalRin page
See ya!!!!!! :D
« Last Edit: May 10, 2005, 12:47:54 PM by iq_132 »

Good and evil co-exist because of the balance, lies are not part of it...

FB Alpha Plus! site infos updated, see the latest info clicking on my profile link...

Offline fataku

  • Newbies
  • *
  • Posts: 22
  • Karma: +0/-0
  • Junior Member
NeoTextROMFix code
« Reply #11 on: December 08, 2004, 12:41:29 AM »
i thought the code was easiest, something like this:

Code: [Select]
if (nNeoTextROMFixType = 7) {
        // thanks to dorriGa and arnoldso for analyze the scramble
        unsigned char *rom = NeoTextROM+0x20000;
        unsigned char *buf = (unsigned char*)malloc( 0x40000 );
        int i, j;

        for (i=0;i<0x40000;i++){
            j=BITSWAP24(i,23,22,21,20,19,18,17,9,8,10,11,0,5,4,3,2,1,6,7,13,16,12,14,15);
            buf[j]=rom[i];
        }
memcpy( rom, buf, 0x40000 );
free( buf );
}

and yeah a code for mame too:

Code: [Select]
static void cthd2k3s1spls(void)
{
// thanks to dorriGa and arnoldso for analyze the scramble
UINT8 *src = (memory_region(REGION_GFX1));
UINT8 *dst = (UINT8*)malloc(0x40000);
int i,j;
for (i=0;i<0x40000;i++){
j=BITSWAP24(i,23,22,21,20,19,18,17,9,8,10,11,0,5,4,3,2,1,6,7,13,16,12,14,15);
dst[j]=src[i];
}
memcpy(src,dst,0x40000);
}
« Last Edit: May 10, 2005, 12:48:05 PM by iq_132 »

Offline Shoometsu

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
  • I finally have an avatar XD
NeoTextROMFix code
« Reply #12 on: December 12, 2004, 04:19:18 PM »
Quote from: fataku
i thought the code was easiest, something like this:

Code: [Select]
if (nNeoTextROMFixType = 7) {
        // thanks to dorriGa and arnoldso for analyze the scramble
        unsigned char *rom = NeoTextROM+0x20000;
        unsigned char *buf = (unsigned char*)malloc( 0x40000 );
        int i, j;

        for (i=0;i<0x40000;i++){
            j=BITSWAP24(i,23,22,21,20,19,18,17,9,8,10,11,0,5,4,3,2,1,6,7,13,16,12,14,15);
            buf[j]=rom[i];
        }
memcpy( rom, buf, 0x40000 );
free( buf );
}

and yeah a code for mame too:

Code: [Select]
static void cthd2k3s1spls(void)
{
// thanks to dorriGa and arnoldso for analyze the scramble
UINT8 *src = (memory_region(REGION_GFX1));
UINT8 *dst = (UINT8*)malloc(0x40000);
int i,j;
for (i=0;i<0x40000;i++){
j=BITSWAP24(i,23,22,21,20,19,18,17,9,8,10,11,0,5,4,3,2,1,6,7,13,16,12,14,15);
dst[j]=src[i];
}
memcpy(src,dst,0x40000);
}

ct2003sp extract the s data from the end of c roms? I don't know if i add this before the 6th or the 5th option according to the extraction (or not)
 :confused:
« Last Edit: May 10, 2005, 12:48:17 PM by iq_132 »
<- Who are you?

Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
NeoTextROMFix code
« Reply #13 on: December 12, 2004, 09:58:33 PM »
No thats meant to descramble the S rom .
IQ Forum Member

Offline Shoometsu

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
  • I finally have an avatar XD
NeoTextROMFix code
« Reply #14 on: December 13, 2004, 08:20:57 PM »
Quote from: James33
No thats meant to descramble the S rom .


Code: [Select]


NeoTextROM = (unsigned char*)malloc(nNeoTextROMSize + 0x020000);
if (NeoTextROM == NULL) {
return 1;

                options 1 to 5 here

        } else {
// Extract data from the end of C ROMS
BurnUpdateProgress(0.0, "Gerando gráficos de texto ", 0);
NeoExtractSData(NeoSpriteROM, NeoTextROM + 0x020000, nSpriteSize, nNeoTextROMSize);

                option 6 here


 where do I insert the 7th option? with the other 5 or with the 6th in thi "if" structure?
<- Who are you?