Author Topic: SVC Chaos driver infos.  (Read 47015 times)

Offline Xeon

  • Newbies
  • *
  • Posts: 45
  • Karma: +0/-0
  • Member
SVC Chaos driver infos.
« Reply #15 on: November 22, 2004, 01:26:20 PM »
hmmm..weird, the error is "...byteswap.h: No such file or directory", is this file suppose to be in my MinGW setup?

Offline iq_132

  • Administrator
  • *****
  • Posts: 3724
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
SVC Chaos driver infos.
« Reply #16 on: November 22, 2004, 01:50:56 PM »
oops... "bitswap.h" :D


Offline Xeon

  • Newbies
  • *
  • Posts: 45
  • Karma: +0/-0
  • Member
SVC Chaos driver infos.
« Reply #17 on: November 22, 2004, 02:12:48 PM »
the darned thing simply hates me  :eek:

Code: [Select]
MinGWC:\fbasrc>make >log.txt
src/burn/neogeo/neo_run.cpp: In function `int LoadRoms(NeoGameInfo*)':
src/burn/neogeo/neo_run.cpp:547: warning: ISO C++ forbids variable-size array `
   buffer'
src/burn/neogeo/neo_decrypt.cpp:448: warning: ISO C++ forbids declaration of `
   NeoExtractSData' with no type
src/burn/neogeo/neo_decrypt.cpp: In function `int NeoExtractSData(unsigned
   char*, unsigned char*, int, int)':
src/burn/neogeo/neo_decrypt.cpp:448: new declaration `int
   NeoExtractSData(unsigned char*, unsigned char*, int, int)'
src/burn/neogeo/neogeo.h:115: ambiguates old declaration `void
   NeoExtractSData(unsigned char*, unsigned char*, int, int)'
src/burn/neogeo/neo_decrypt.cpp: In function `int NeoExtractSData(unsigned
   char*, unsigned char*, int, int)':
src/burn/neogeo/neo_decrypt.cpp:481: `BITSWAP08' undeclared (first use this
   function)
src/burn/neogeo/neo_decrypt.cpp:481: (Each undeclared identifier is reported
   only once for each function it appears in.)
src/burn/neogeo/neo_decrypt.cpp:484: warning: no return statement in function
   returning non-void
C:\MINGW\BIN\MAKE.EXE: *** [neo_decrypt.o] Error 1

MinGWC:\fbasrc>exit

time for a re-check i guess
« Last Edit: May 10, 2005, 12:16:24 PM by iq_132 »

Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
SVC Chaos driver infos.
« Reply #18 on: November 22, 2004, 05:33:29 PM »
Any chance to post the converted code for the P roms of kof2003? thanks for all the convertions man!!!!!!!!!!
See ya!!!!  :D

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
SVC Chaos driver infos.
« Reply #19 on: November 22, 2004, 05:43:23 PM »
The driver is not complete and does not work

EDIT : All sorted now .For Mame32 Plus
IQ Forum Member

Offline James33

  • Expert
  • *****
  • Posts: 532
  • Karma: +3/-0
  • The Mame Man
    • Emulation Zone
SVC Chaos driver infos.
« Reply #20 on: November 23, 2004, 01:37:31 AM »
Quote from: iq_132
And here's the P rom decryption code for these P roms (svcplus):

Code: [Select]
{"svc-p1p.bin", 0x200000, 0xA194D842, 0x10}, //  0 68K code
{"svc-p2p.bin", 0x200000, 0x50C0E2B7, 0x10}, //  1
{"svc-p3p.bin", 0x200000, 0x58CDC293, 0x10}, //  2

Code: [Select]
// Analyzed by HalRIN - http://www52.tok2.com/home/foge/
static void svcplus_px_decrypt()
{
int sec[] = {0x00, 0x03, 0x02, 0x05, 0x04, 0x01};

unsigned char *src = Neo68KROM01;
int i,ofst,rom_size = 0x600000;
unsigned char *dst = (unsigned char*)malloc( rom_size );

memcpy( dst, src, rom_size );
for( i = 0; i < rom_size / 2; i++ ){
ofst = BITSWAP24( (i & 0xfffff), 0x17, 0x16, 0x15, 0x14, 0x13, 0x00, 0x01, 0x02,
0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
0x07, 0x06, 0x05, 0x04, 0x03, 0x10, 0x11, 0x12 );
ofst ^= 0x0f0007;
ofst += (i & 0xff00000);
memcpy( &src[ i * 2 ], &dst[ ofst * 2 ], 0x02 );
}
memcpy( dst, src, rom_size );
for( i = 0; i < 6; i++ ){
memcpy( &src[ i << 20 ], &dst[ sec[ i ] << 20 ], (1 << 20) );
}
free( dst );

*((unsigned short*)(Neo68KROM01 + 0xF8016)) = 0x33c1; // Patch protected address
}

in case this is not known this rom uses the same init as svcplusa .
« Last Edit: October 29, 2006, 02:05:37 AM by iq_132 »
IQ Forum Member

Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
SVC Chaos driver infos.
« Reply #21 on: November 23, 2004, 02:09:52 AM »
If anyone has problems with the NeoExtractSdata that IQ_132 posted, maybe this can help.
Replace the whole old code with this:
Code: [Select]
// Analyzed by HalRIN - http://www52.tok2.com/home/foge/
void NeoExtractSData(unsigned char* rom, unsigned char* sdata, int rom_size, int sdata_size)
{
int i;
if (sdata_size == 0x100000) {
unsigned char *src = rom + rom_size - 0x1000000 - 0x80000;
unsigned char *dst = sdata;

// This extracts the first 512k of S data
for( i = 0; i < sdata_size / 2; i++ ) {
dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ];
}

src = rom + rom_size - 0x80000;
dst = sdata + 0x80000;

// This extracts the second 512k of S data
for( i = 0; i < sdata_size / 2; i++ ) {
dst[ i ] = src[ (i & ~0x1f) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4) ];
}

// This descrambles the S data (kof2003)
dst = sdata;
for( i = 0; i < sdata_size; i++ ) {
dst[ i ] = BITSWAP08( dst[ i ] ^ 0xd2, 4, 0, 7, 2, 5, 1, 6, 3 );
}
} else {
/* the S data comes from the end fo the C data */
rom += rom_size - sdata_size;

for ( i = 0; i < sdata_size; i++) {
sdata[i] = rom[(i & ~0x1F) + ((i & 7) << 2) + ((~i & 8) >> 2) + ((i & 0x10) >> 4)];
}
}
}
and add this in the top of the file:
Code: [Select]
#include "bitswap.h"Is the same as the code posted bi IQ... but maybe it will work if you have probs...
See ya!!!!! :D
« Last Edit: October 29, 2006, 02:05:55 AM 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 Xeon

  • Newbies
  • *
  • Posts: 45
  • Karma: +0/-0
  • Member
SVC Chaos driver infos.
« Reply #22 on: November 23, 2004, 02:50:11 AM »
it worked now, thanks ferch (can i call you that? :D)

Offline Vorador

  • Newbies
  • *
  • Posts: 18
  • Karma: +0/-0
  • Junior Member
Neo-PVC code traduction
« Reply #23 on: November 23, 2004, 04:41:40 PM »
Here it is, is quite simple to convert (only redefinitions & conversions)  :D
Code: [Select]
// Original code by HalRIN -- http://www52.tok2.com/home/foge/
static void svcchaos_px_decrypt( void )
{
const unsigned char xor1[ 0x20 ] = {
0x3b, 0x6a, 0xf7, 0xb7, 0xe8, 0xa9, 0x20, 0x99, 0x9f, 0x39, 0x34, 0x0c, 0xc3, 0x9a, 0xa5, 0xc8,
0xb8, 0x18, 0xce, 0x56, 0x94, 0x44, 0xe3, 0x7a, 0xf7, 0xdd, 0x42, 0xf0, 0x18, 0x60, 0x92, 0x9f,
};

const unsigned char xor2[ 0x20 ] = {
0x69, 0x0b, 0x60, 0xd6, 0x4f, 0x01, 0x40, 0x1a, 0x9f, 0x0b, 0xf0, 0x75, 0x58, 0x0e, 0x60, 0xb4,
0x14, 0x04, 0x20, 0xe4, 0xb9, 0x0d, 0x10, 0x89, 0xeb, 0x07, 0x30, 0x90, 0x50, 0x0e, 0x20, 0x26,
};

int i;
int ofst;
unsigned char *rom, *buf;

rom = Neo68KROM01;

for( i = 0; i < 0x100000; i++ ){
rom[ i ] ^= xor1[ (i % 0x20) ];
}

for( i = 0x100000; i < 0x800000; i++ ){
rom[ i ] ^= xor2[ (i % 0x20) ];
}

for( i = 0x100000; i < 0x800000; i += 4 ){
UINT16 *rom16 = (UINT16*)&rom[ i + 1 ];
*rom16 = BITSWAP16( *rom16, 15, 14, 13, 12, 10, 11, 8, 9, 6, 7, 4, 5, 3, 2, 1, 0 );
}

buf = (unsigned char*)malloc( 0x800000 );
memcpy( buf, rom, 0x800000 );

for( i = 0; i < 0x0100000 / 0x10000; i++ ){
ofst = (i & 0xf0) + BITSWAP08( (i & 0x0f), 7, 6, 5, 4, 2, 3, 0, 1 );
memcpy( &rom[ i * 0x10000 ], &buf[ ofst * 0x10000 ], 0x10000 );
}

for( i = 0x100000; i < 0x800000; i += 0x100 ){
ofst = (i & 0xf000ff) +
  ((i & 0x000f00) ^ 0x00a00) +
  (BITSWAP08( ((i & 0x0ff000) >> 12), 4, 5, 6, 7, 1, 0, 3, 2 ) << 12);

memcpy( &rom[ i ], &buf[ ofst ], 0x100 );
}

free( buf );

buf = (unsigned char*)malloc( 0x800000 );
memcpy( buf, rom, 0x800000 );
memcpy( &rom[ 0x100000 ], &buf[ 0x700000 ], 0x100000 );
memcpy( &rom[ 0x200000 ], &buf[ 0x100000 ], 0x600000 );
free( buf );
}

Offline FerchogtX

  • FBNeo Dev
  • ******
  • Posts: 375
  • Karma: +7/-0
  • FB Alpha Team ;)
    • FB Alpha Plus! Web Site
SVC Chaos driver infos.
« Reply #24 on: November 23, 2004, 05:41:18 PM »
Thanks man!!!!!! now we need the read and write handlers for the bankswitch...
See ya!!!!! :D

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 Xeon

  • Newbies
  • *
  • Posts: 45
  • Karma: +0/-0
  • Member
SVC Chaos driver infos.
« Reply #25 on: November 23, 2004, 11:29:56 PM »
i got the NeoExtractSData code to compile but i still cant get the text data to work properly for svcnd. do i need to add HARDWARE_SNK_ALTERNATE_TEXT and/or set the nTextBankSwitch?

also, will it work for kof2003 8x8 C ROMs?

sorry for asking like a n00b to this but i havent followed this driver scene for a while now :o

Offline iq_132

  • Administrator
  • *****
  • Posts: 3724
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
SVC Chaos driver infos.
« Reply #26 on: November 24, 2004, 02:42:03 AM »
Quote from: Xeon
i got the NeoExtractSData code to compile but i still cant get the text data to work properly for svcnd. do i need to add HARDWARE_SNK_ALTERNATE_TEXT and/or set the nTextBankSwitch?


For svcnd, you need:
HARDWARE_SNK_ALTERNATE_TEXT
nNeoTextROMSize = 0x80000;

and you need to add this code to your nTextBankSwitch stuff (If you have that code added)

Code: [Select]
srom = NeoTextROM+0x20000;  
(int i=0;i srom[i]=BITSWAP08(srom[i]^0xd2,4,0,7,2,5,1,6,3 );


Quote
also, will it work for kof2003 8x8 C ROMs?

No.  Those roms don't contain S data.

Quote
sorry for asking like a n00b to this but i havent followed this driver scene for a while now :o

lol, it's ok man :)  Everybody gets behind sometimes ;)


Offline Xeon

  • Newbies
  • *
  • Posts: 45
  • Karma: +0/-0
  • Member
SVC Chaos driver infos.
« Reply #27 on: November 24, 2004, 03:45:22 AM »
okay thanks :)

i have the nTextBankSwitch code but where can i put in that piece of code in the following code?:

Code: [Select]
if (nTextBankswitch == 1) {
unsigned char* dst = (unsigned char*)malloc(0x20000);
unsigned char* roms1 = NeoTextROM+0x20000;
if ( dst )
{
memcpy(dst,roms1,0x20000);
for ( int j=0;j<0x20000 ; j+=0x000010)
{
memcpy( roms1+j, dst+j+0x000008,8);
memcpy( roms1+j+0x000008, dst+j,8);
}
}
free( dst );
}

if (nTextBankswitch == 2) {
unsigned char* srom = NeoTextROM+0x20000;
unsigned char* dst2 = (unsigned char*)malloc(0x80000);
memcpy( dst2+0x00000, srom+0x60000, 0x20000 );
memcpy( dst2+0x20000, srom+0x40000, 0x20000 );
memcpy( dst2+0x40000, srom+0x20000, 0x20000 );
memcpy( dst2+0x60000, srom+0x00000, 0x20000 );
memcpy( srom, dst2, 0x80000 );
free(dst2);
}

or do i have the nTextBankswitch code outdated?
« Last Edit: May 10, 2005, 12:17:07 PM by iq_132 »

Offline iq_132

  • Administrator
  • *****
  • Posts: 3724
  • Karma: +411/-0
  • Definitely not Dink!
    • NeoSource
SVC Chaos driver infos.
« Reply #28 on: November 24, 2004, 05:28:03 AM »
oh, and I forgot to say make sure you have
#include "bitswap.h" in the top of neo_run.cpp


if (nTextBankswitch == 4) {
   unsigned char* srom = NeoTextROM+0x20000;  
(int i=0;i   srom=BITSWAP08(srom^0xd2,4,0,7,2,5,1,6,3 );
}


Offline Xeon

  • Newbies
  • *
  • Posts: 45
  • Karma: +0/-0
  • Member
SVC Chaos driver infos.
« Reply #29 on: November 24, 2004, 12:30:34 PM »
crap, not again :(

Code: [Select]
src/burn/neogeo/neo_run.cpp: In function `int LoadRoms(NeoGameInfo*)':
src/burn/neogeo/neo_run.cpp:460: parse error before `=' token
src/burn/neogeo/neo_run.cpp:459: warning: unused variable `unsigned char*srom'
src/burn/neogeo/neo_run.cpp:553: warning: ISO C++ forbids variable-size array `
   buffer'
C:\MINGW\BIN\MAKE.EXE: *** [neo_run.o] Error 1
« Last Edit: May 10, 2005, 12:17:18 PM by iq_132 »