Welcome!
Final Burn Neo => FBN Development => Topic started by: iq_132 on December 03, 2005, 02:43:23 PM
-
Here's a fully working driver. Enjoy ;)
// The King of Gladiator (Bootleg)
static struct BurnRomInfo kogRomDesc[] = {
{ "5232-p1.bin", 0x200000, 0xD2413EC6, 1 | BRF_ESS | BRF_PRG }, // 0 68K code
{ "232-p2.bin", 0x400000, 0x158B23F6, 1 | BRF_ESS | BRF_PRG }, // 1
{ "5232-s1.bin", 0x020000, 0x0BEF69DA, 2 | BRF_GRA }, // 2 Text data
{ "5232-c1a.bin", 0x800000, 0x4EAB9B0A, 3 | BRF_GRA }, // 3 Sprite data
{ "5232-c2a.bin", 0x800000, 0x697F8FD0, 3 | BRF_GRA }, // 4
{ "5232-c1b.bin", 0x800000, 0x1143FDF3, 3 | BRF_GRA }, // 5
{ "5232-c2b.bin", 0x800000, 0xEA82CF8F, 3 | BRF_GRA }, // 6
{ "5232-c3.bin", 0x400000, 0xABD1BE07, 3 | BRF_GRA }, // 7
{ "5232-c4.bin", 0x400000, 0xD2BD967B, 3 | BRF_GRA }, // 8
{ "232-m1.bin", 0x020000, 0x45348747, 4 | BRF_ESS | BRF_PRG }, // 9 Z80 code
{ "232-v1.bin", 0x400000, 0x22A2B5B5, 5 | BRF_SND }, // 10 Sound data
{ "232-v2.bin", 0x400000, 0x2304E744, 5 | BRF_SND }, // 11
{ "232-v3.bin", 0x400000, 0x759EB954, 5 | BRF_SND }, // 12
};
STDROMPICKEXT(kog, kog, neogeo);
STD_ROM_FN(kog);
static void kog_sx_decrypt()
{
unsigned char* tmp = (unsigned char*)malloc(0x20000);
if (tmp) {
memcpy( tmp, NeoTextROM + 0x20000, 0x20000 );
// descrambling the S1 by dorriGa
for ( int j = 0; j < 0x20000; j += 0x000010 ) {
memcpy( NeoTextROM + 0x20000 + j, tmp + j + 0x000008, 8);
memcpy( NeoTextROM + 0x20000 + j + 0x000008, tmp + j, 8);
}
}
free( tmp );
}
static void kog_cx_decrypt()
{
unsigned char *src = NeoSpriteROM
unsigned char* cso = (unsigned char*)malloc(64);
for (int i = 0; i < 0x2800000; i += 128){
memcpy(cso, src + i, 64);
memcpy(src + i, src + i + 64, 64);
memcpy(src + i + 64, cso, 64);
}
free(cso);
}
// IQ_132 - http://neosource.1emu.net/
// Thanks to Razoola for the info
static void kog_px_decrypt()
{
unsigned char *src = Neo68KROM;
unsigned char *dst = (unsigned char*)malloc(0x600000);
unsigned int sec[] = { 0x3, 0x8, 0x7, 0xC, 0x1, 0xA, 0x6, 0xD };
if (dst)
{
for (int i = 0; i < 8; i++)
memcpy (dst + i * 0x20000, src + sec[i] * 0x20000, 0x20000);
memcpy (dst + 0x0007A6, src + 0x0407A6, 0x000006);
memcpy (dst + 0x0007C6, src + 0x0407C6, 0x000006);
memcpy (dst + 0x0007E6, src + 0x0407E6, 0x000006);
memcpy (dst + 0x090000, src + 0x040000, 0x004000);
memcpy (dst + 0x100000, src + 0x200000, 0x400000);
memcpy (src, dst, 0x600000);
free (dst);
}
for (int i = 0x90000; i < 0x94000; i++)
{
if (((*((unsigned short*)(src + i))&0xFFBF) == 0x4EB9 || *((unsigned short*)(src + i)) == 0x43F9) && !*((unsigned short*)(src + i + 2)))
*((unsigned short*)(src + i + 2)) = 0x0009;
if (*((unsigned short*)(src + i)) == 0x4EB8)
*((unsigned short*)(src + i)) = 0x6100;
}
*((unsigned short*)(src + 0x007A8)) = 0x0009;
*((unsigned short*)(src + 0x007C8)) = 0x0009;
*((unsigned short*)(src + 0x007E8)) = 0x0009;
*((unsigned short*)(src + 0x93408)) = 0xF168;
*((unsigned short*)(src + 0x9340C)) = 0xFB7A;
*((unsigned short*)(src + 0x924AC)) = 0x0009;
*((unsigned short*)(src + 0x9251C)) = 0x0009;
*((unsigned short*)(src + 0x93966)) = 0xFFDA;
*((unsigned short*)(src + 0x93974)) = 0xFFCC;
*((unsigned short*)(src + 0x93982)) = 0xFFBE;
*((unsigned short*)(src + 0x93990)) = 0xFFB0;
*((unsigned short*)(src + 0x9399E)) = 0xFFA2;
*((unsigned short*)(src + 0x939AC)) = 0xFF94;
*((unsigned short*)(src + 0x939BA)) = 0xFF86;
*((unsigned short*)(src + 0x939C8)) = 0xFF78;
*((unsigned short*)(src + 0x939D4)) = 0xFA5C;
*((unsigned short*)(src + 0x939E0)) = 0xFA50;
*((unsigned short*)(src + 0x939EC)) = 0xFA44;
*((unsigned short*)(src + 0x939F8)) = 0xFA38;
*((unsigned short*)(src + 0x93A04)) = 0xFA2C;
*((unsigned short*)(src + 0x93A10)) = 0xFA20;
*((unsigned short*)(src + 0x93A1C)) = 0xFA14;
*((unsigned short*)(src + 0x93A28)) = 0xFA08;
*((unsigned short*)(src + 0x93A34)) = 0xF9FC;
*((unsigned short*)(src + 0x93A40)) = 0xF9F0;
*((unsigned short*)(src + 0x93A4C)) = 0xFD14;
*((unsigned short*)(src + 0x93A58)) = 0xFD08;
*((unsigned short*)(src + 0x93A66)) = 0xF9CA;
*((unsigned short*)(src + 0x93A72)) = 0xF9BE;
src[0xFFFFE] = 0x01; // Enable "King of Gladiator" on Title Screen
kog_cx_decrypt();
kog_sx_decrypt();
}
static int kogInit()
{
pNeoInitCallback = kog_px_decrypt;
return NeoInit();
}
struct BurnDriver BurnDrvkog = {
"kog", "kof97", "neogeo", "2005",
"The King of Gladiator (Hack)\0", NULL, "SNK Corp. of America", "Neo Geo",
NULL, NULL, NULL, NULL,
BDF_GAME_WORKING | BDF_BOOTLEG | BDF_CLONE, 2, HARDWARE_SNK_NEOGEO,
NULL, kogRomInfo, kogRomName, neogeoInputInfo, neogeoDIPInfo,
kogInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
nNeoScreenWidth, 224, 4, 3
};
-
At last! I really don't think I would have worked out those patches.
Converted to MAME code and it works!
With small adjustments it perfectly works
(http://www.multijogos.com.br/kog0002.png) (http://www.multijogos.com.br/kog.png)
http://www.multijogos.com.br/kog0000.png
http://www.multijogos.com.br/kog0004.png
here my complete code used in Mame v0.102
ROM_START( kog )
ROM_REGION( 0x600000, REGION_CPU1, 0 )
ROM_LOAD16_WORD_SWAP( "5232-p1.bin", 0x000000, 0x200000, CRC(D2413EC6) SHA1(C0BF409D1E714CBA5FDC6F79E4C2AEC805316634) )
ROM_LOAD16_WORD_SWAP( "232-p2.bin", 0x200000, 0x400000, CRC(158B23F6) SHA1(9744620a70513490aaf9c5eda33e5ec31222be19) )
NEO_SFIX_128K( "5232-s1.bin", CRC(0BEF69DA) SHA1(80918586E694DCE35C4DBA796EB18ABF6A070EBB) )
NEO_BIOS_SOUND_128K( "232-m1.bin", CRC(45348747) SHA1(ed77cbae2b208d1177a9f5f6e8cd57070e90b65b) )
ROM_REGION( 0xc00000, REGION_SOUND1, 0 )
ROM_LOAD( "232-v1.bin", 0x000000, 0x400000, CRC(22a2b5b5) SHA1(ebdbc977332e6d93e266755000b43857e0082965) )
ROM_LOAD( "232-v2.bin", 0x400000, 0x400000, CRC(2304e744) SHA1(98d283e2bcc9291a53f52afd35ef76dfb0828432) )
ROM_LOAD( "232-v3.bin", 0x800000, 0x400000, CRC(759eb954) SHA1(54e77c4e9e6b89458e59824e478ddc33a9c72655) )
NO_DELTAT_REGION
ROM_REGION( 0x2800000, REGION_GFX3, 0 )
ROM_LOAD16_BYTE( "5232-c1a.bin", 0x0000000, 0x800000, CRC(4EAB9B0A) ) /* Plane 0,1 */
ROM_LOAD16_BYTE( "5232-c2a.bin", 0x0000001, 0x800000, CRC(697f8fd0) ) /* Plane 2,3 */
ROM_LOAD16_BYTE( "5232-c1b.bin", 0x1000000, 0x800000, CRC(1143fdf3) ) /* Plane 0,1 */
ROM_LOAD16_BYTE( "5232-c2b.bin", 0x1000001, 0x800000, CRC(EA82CF8F) ) /* Plane 2,3 */
ROM_LOAD16_BYTE( "5232-c3.bin", 0x2000000, 0x400000, CRC(ABD1BE07) ) /* Plane 0,1 */
ROM_LOAD16_BYTE( "5232-c4.bin", 0x2000001, 0x400000, CRC(D2BD967B) ) /* Plane 2,3 */
ROM_END
static void kog_sx_decrypt( void )
{
int i;
int rom_size = memory_region_length( REGION_GFX1 );
UINT8 *rom = memory_region( REGION_GFX1 );
UINT8 *buf = malloc( rom_size );
memcpy( buf, rom, rom_size );
for(i = 0; i < rom_size; i += 0x10 ){
memcpy( &rom[ i ], &buf[ i + 0x08 ], 0x08 );
memcpy( &rom[ i + 0x08 ], &buf[ i ], 0x08 );
}
free( buf );
}
static void kog_cx_decrypt( void )
{
int i;
int cx_size = memory_region_length( REGION_GFX3 );
UINT8 *rom = memory_region( REGION_GFX3 );
UINT8 *buf = malloc( cx_size );
memcpy( buf, rom, cx_size );
for(i = 0; i < cx_size / 0x40; i++ ){
memcpy( &rom[ i * 0x40 ], &buf[ (i ^ 1) * 0x40 ], 0x40 );
}
free( buf );
}
// IQ_132 - http://neosource.1emu.net/
// Thanks to Razoola for the info
// Small Correctoins by Macgaiver -- Thanks to JiMMy_Page for any Help.
static void kog_px_decrypt( void )
{
int i;
UINT8 *src = memory_region( REGION_CPU1 );
UINT8 *pTemp = (UINT8 *)malloc( 0x600000 );
int sec[] = { 0x3, 0x8, 0x7, 0xC, 0x1, 0xA, 0x6, 0xD };
if (pTemp)
{
for (i = 0; i < 8; i++)
memcpy (pTemp + i * 0x20000, src + sec[i] * 0x20000, 0x20000);
memcpy (pTemp + 0x0007A6, src + 0x0407A6, 0x000006);
memcpy (pTemp + 0x0007C6, src + 0x0407C6, 0x000006);
memcpy (pTemp + 0x0007E6, src + 0x0407E6, 0x000006);
memcpy (pTemp + 0x090000, src + 0x040000, 0x004000);
memcpy (pTemp + 0x100000, src + 0x200000, 0x400000);
memcpy (src, pTemp, 0x600000);
free (pTemp);
}
for (i = 0x90000; i < 0x94000; i++)
{
if (((*((UINT16*)(src + i))&0xFFBF) == 0x4EB9 || *((UINT16*)(src + i)) == 0x43F9) && !*((UINT16*)(src + i + 2)))
*((UINT16*)(src + i + 2)) = 0x0009;
if (*((UINT16*)(src + i)) == 0x4EB8)
*((UINT16*)(src + i)) = 0x6100;
}
*((UINT16*)(src + 0x007A8)) = 0x0009;
*((UINT16*)(src + 0x007C8)) = 0x0009;
*((UINT16*)(src + 0x007E8)) = 0x0009;
*((UINT16*)(src + 0x93408)) = 0xF168;
*((UINT16*)(src + 0x9340C)) = 0xFB7A;
*((UINT16*)(src + 0x924AC)) = 0x0009;
*((UINT16*)(src + 0x9251C)) = 0x0009;
*((UINT16*)(src + 0x93966)) = 0xFFDA;
*((UINT16*)(src + 0x93974)) = 0xFFCC;
*((UINT16*)(src + 0x93982)) = 0xFFBE;
*((UINT16*)(src + 0x93990)) = 0xFFB0;
*((UINT16*)(src + 0x9399E)) = 0xFFA2;
*((UINT16*)(src + 0x939AC)) = 0xFF94;
*((UINT16*)(src + 0x939BA)) = 0xFF86;
*((UINT16*)(src + 0x939C8)) = 0xFF78;
*((UINT16*)(src + 0x939D4)) = 0xFA5C;
*((UINT16*)(src + 0x939E0)) = 0xFA50;
*((UINT16*)(src + 0x939EC)) = 0xFA44;
*((UINT16*)(src + 0x939F8)) = 0xFA38;
*((UINT16*)(src + 0x93A04)) = 0xFA2C;
*((UINT16*)(src + 0x93A10)) = 0xFA20;
*((UINT16*)(src + 0x93A1C)) = 0xFA14;
*((UINT16*)(src + 0x93A28)) = 0xFA08;
*((UINT16*)(src + 0x93A34)) = 0xF9FC;
*((UINT16*)(src + 0x93A40)) = 0xF9F0;
*((UINT16*)(src + 0x93A4C)) = 0xFD14;
*((UINT16*)(src + 0x93A58)) = 0xFD08;
*((UINT16*)(src + 0x93A66)) = 0xF9CA;
*((UINT16*)(src + 0x93A72)) = 0xF9BE;
src[0xFFFFE] = 0x01; // Enable "King of Gladiator" on Title Screen
}
DRIVER_INIT( kog )
{
kog_cx_decrypt();
kog_px_decrypt();
kog_sx_decrypt();
init_neogeo();
}
GAMEB( 2002, kog, neogeo, neogeo, neogeo, neogeo, kog, ROT0, "Eolith / Playmore Corporation", "King of Gladiator", 0 )
/* Here in ./src/machine/machine.c */
!strcmp(Machine->gamedrv->name,"kog") ||
-
Excuse me for posting in the wrong place.. please it moves this post for the correct place..
Thankful..
-
Thanks for this fine driver.....
any chance to make a fully decrypted set (P1, S1, Cx) for this crappy bootleg ????
-
Thanks for this fine driver.....
any chance to make a fully decrypted set (P1, S1, Cx) for this crappy bootleg ????
I hope this ok to post here ?
-
Thanks :D
-
With small adjustments it perfectly works
not working... only system menu on the screen... why? any suggestions?
UPD: that was a bad dump, the new one works perfectly
-
I'm recompiling FBA 0.2.95.23 source code with VC, using this driver, that was written above...
it sometimes starts the game... but more often crashes unpredictably, writing this in details...
FB Alpha v0.2.95.23 fatal exception report (Wed Dec 21 14:01:50 2005)
----------------------------------------------------------------------
Exception 0xC0000005 (EXCEPTION_ACCESS_VIOLATION) thrown.
EIP: 0x7C91
(attempting to read address 0x020D900D)
EAX: 0x0007FFF8, EBX: 0x011E0000, ECX: 0x0012F9D4, EDX: 0x00011000
ESI: 0x020D9008, EDI: 0x02159000, ESP: 0x0012F99C, EBP: 0x0012F9A8
----------------------------------------------------------------------
System information:
OS: Microsoft Windows XP Professional Service Pack 2 (build 2600)
CPU: GenuineIntel, Pentium 4 "Northwood"
2399 MHz, MMX, SSE, SSE2 (2 system processors)
Physical RAM: 1048044 KB (1023 MB) total, 739220 KB ( 721 MB) avail
Total RAM: 1733952 KB (1693 MB) total, 1554692 KB (1518 MB) avail
FB Alpha: 12540 KB in use (75336 KB peak, 10284 KB virtual)
Installed displays and display adapters:
Plug and Play Monitor on NVIDIA GeForce 6600 GT (primary)
----------------------------------------------------------------------
FB Alpha information:
Built on Dec 21 2005, 13:59:09, using Visual C++ 8.0.
Optimised for i686 CPUs.
Using multi-byte characters for all text, active codepage is 1251.
Debug functionality absent.
MMX optimisations enabled.
A68K emulation core enabled for MC68000 emulation.
Musashi emulation core enabled for MC68010/MC68EC020 emulation.
Doze emulation core enabled for Z80 emulation.
Not emulating any game.
Video settings:
Interface settings: Video plugin not initialised
Audio settings:
Selected module: DirectSound3 audio output
Interface settings: Playback at 22050Hz, 100% volume
Module settings: Audio is delayed by approx. 84ms
Input settings:
Selected module: DirectInput7 input
Interface settings: keyboard 0 System keyboard: Клавиатура
mouse 0 System mouse: Мышь
Profiling settings:
Interface settings: Profiling module not initialised
----------------------------------------------------------------------
Detailed process information about fbaa.exe:
fbaa.exe (base address 0x00400000, size 5332 KB)
Exception occurred in module ntdll.dll: ntdll.dll (base address 0x7C900000, size 704 KB)
Modules loaded by fbaa.exe:
ntdll.dll (base address 0x7C900000, size 704 KB)
kernel32.dll (base address 0x7C800000, size 976 KB)
USER32.dll (base address 0x77D40000, size 576 KB)
GDI32.dll (base address 0x77F10000, size 280 KB)
comdlg32.dll (base address 0x763B0000, size 292 KB)
SHLWAPI.dll (base address 0x77F60000, size 472 KB)
msvcrt.dll (base address 0x77C10000, size 352 KB)
ADVAPI32.dll (base address 0x77DD0000, size 620 KB)
RPCRT4.dll (base address 0x77E70000, size 580 KB)
COMCTL32.dll (base address 0x773D0000, size 1032 KB)
SHELL32.dll (base address 0x7C9C0000, size 8272 KB)
WINMM.dll (base address 0x76B40000, size 180 KB)
d3d9.dll (base address 0x4FDD0000, size 1688 KB)
d3d8thk.dll (base address 0x6D990000, size 24 KB)
VERSION.dll (base address 0x77C00000, size 32 KB)
d3dx9_26.dll (base address 0x00940000, size 2344 KB)
DDRAW.dll (base address 0x73760000, size 292 KB)
DCIMAN32.dll (base address 0x73BC0000, size 24 KB)
DSOUND.dll (base address 0x73F10000, size 368 KB)
ole32.dll (base address 0x774E0000, size 1264 KB)
DINPUT.dll (base address 0x72280000, size 168 KB)
kailleraclient.dll (base address 0x10000000, size 92 KB)
WS2_32.dll (base address 0x71AB0000, size 92 KB)
WS2HELP.dll (base address 0x71AA0000, size 32 KB)
IMM32.DLL (base address 0x76390000, size 116 KB)
LPK.DLL (base address 0x629C0000, size 36 KB)
USP10.dll (base address 0x74D90000, size 428 KB)
MSCTF.dll (base address 0x74720000, size 300 KB)
msctfime.ime (base address 0x755C0000, size 184 KB)
RICHED32.DLL (base address 0x732E0000, size 20 KB)
RICHED20.dll (base address 0x74E30000, size 432 KB)
Secur32.dll (base address 0x77FE0000, size 68 KB)
CLBCATQ.DLL (base address 0x76FD0000, size 508 KB)
OLEAUT32.dll (base address 0x77120000, size 560 KB)
COMRes.dll (base address 0x77050000, size 788 KB)
mslbui.dll (base address 0x605D0000, size 36 KB)
UxTheme.dll (base address 0x5AD70000, size 224 KB)
HID.DLL (base address 0x688F0000, size 36 KB)
SETUPAPI.DLL (base address 0x77920000, size 972 KB)
WINTRUST.dll (base address 0x76C30000, size 184 KB)
CRYPT32.dll (base address 0x77A80000, size 592 KB)
MSASN1.dll (base address 0x77B20000, size 72 KB)
IMAGEHLP.dll (base address 0x76C90000, size 160 KB)
msi.dll (base address 0x015B0000, size 2840 KB)
wdmaud.drv (base address 0x72D20000, size 36 KB)
msacm32.drv (base address 0x72D10000, size 32 KB)
MSACM32.dll (base address 0x77BE0000, size 84 KB)
midimap.dll (base address 0x77BD0000, size 28 KB)
KsUser.dll (base address 0x73EE0000, size 16 KB)
----------------------------------------------------------------------
-
finally it's working!.. but I suppose you've made a mistake... you're trying to write memory more, than you took it before...
static void kog_cx_decrypt()
{
// unsigned char* cso = (unsigned char*)malloc(64);
unsigned char* cso = (unsigned char*)malloc(128); // this one is correct
for (int i = 0; i < 0x2800000; i += 128){
memcpy(cso + 0, NeoSpriteROM + i + 64, 64);
memcpy(cso + 64, NeoSpriteROM + i + 0, 64);
memcpy(NeoSpriteROM + i, cso, 128);
}
free(cso);
}
maybe it working on your system, but not on my... thanks anyway, you've already helped me twice...
PS and sorry again for my poor English...
-
Thanks, I've fixed the code in the first post... It should work as intended now.
btw, Razoola posted some info on the MAME.net forums, I'll post some code soon-ish.
-
Or you can make it so that it switches depending on whether or not your machine is set to USA, ASIA, or Japan ;)
// Thanks to Razoola for the info!
unsigned char __fastcall kog_enable_title(unsigned int sekAddress)
{
extern unsigned char *Neo68KRAM; // Main 68K RAM
if (sekAddress == 0xFFFFF) return (Neo68KRAM[0x0FD82]+1)>>1;
return 0xFF;
}
static int kogInit()
{
int nRet;
pNeoInitCallback = kogDecrypt;
nRet=NeoInit();
if (nRet == 0) {
SekMapHandler(5, 0x0FFFFE, 0x0FFFFF, SM_READ);
SekSetReadByteHandler(5, kog_enable_title);
}
return nRet;
}
-
Cool I am going to try and add this to Mame .