Final Burn Neo > FBN Development

Fix for Chinese directories

(1/2) > >>

iq_132:
This was posted on the FBA forums by Jan, and I thought I'd mirror it here (since most of you probably don't frequent that forum).

In cona.cpp (src/burner/win32/)

Find this:

--- Code: --- if ((h = _tfopen(szConfig, _T("rt"))) == NULL) {
return 1;
}
--- End code ---

and change it to this:

--- Code: --- if ((h = _tfopen(szConfig, _T("rb"))) == NULL) {
return 1;
}
--- End code ---

There's only one problem with this though... you can't manually edit the config file without some problems.

I think I may have to write something to make the directories stored in a different config file...

pigcat:
open src/burner/win32/main.cpp

---------------
find
#include "burner.h"

add after

#include

---------------
find
// Main program entry point
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpCmdLine, int nShowCmd)
{

add after
   setlocale(LC_ALL, ("Chinese_China"));

-------------

咳,英文不好,不过这里是有些国人的,在琵琶行那边看到一帮人讨论这个问题很久也没得要领,不过那边禁止注册了,看他们郁闷的不行,我是想告诉他们该怎么做也告不成。

这个问题是由于使用了_UNICODE定义,编译时的c-runtime库就会使用fprintf这类函数的unicode版本,所以在使用这些函数之前,要先用setlocale设置本地化标记,才能使这些unicode版本的函数正常处理多字节. :D

netbug:
呵呵……我也用中文来说一个bug,
在neo_run.cpp中主要应用于svcboot驱动系列。和fba不认长的声音文件名比如5003-v1
bug in loading Sound data in neo_run.cpp


find:
if (pInfo->nADPCMBNum == 0) {
nYM2610ADPCMASize *= pName[FindType(pName) + 1] - '1';
} else {
nYM2610ADPCMASize *= pName[FindType(pName) + 2] - '1';
}


replace with :
/*
if (pInfo->nADPCMBNum == 0) {
nYM2610ADPCMASize *= pName[FindType(pName) + 1] - '1';
} else {
nYM2610ADPCMASize *= pName[FindType(pName) + 2] - '1';
}*/

if ((!strcmp(BurnDrvGetTextA(DRV_NAME), "pbobblen")) || (!strcmp(BurnDrvGetTextA(DRV_NAME), "pbobblna"))) {
nYM2610ADPCMASize *= 3;
} else {
nYM2610ADPCMASize *=pInfo->nADPCMANum-1;
}

netbug:
//for instance 应用举例
// SvC Chaos: SNK vs Capcom (bootleg) 格斗之王对街头霸王:混沌版 (盗版)

static struct BurnRomInfo svcbootRomDesc[] = {
    {"svc-p1.bin", 0x800000, 0x0348F162, 1 | BRF_ESS | BRF_PRG},   // 0 68K code

    {"svc-s1.bin", 0x020000, 0x70B44DF1, 2 | BRF_GRA},   // 1

    {"svc-c1.bin", 0x800000, 0xA7826B89, 3 | BRF_GRA},   // 2 Sprite data
    {"svc-c2.bin", 0x800000, 0xED3C2089, 3 | BRF_GRA},   // 3
    {"svc-c3.bin", 0x800000, 0x71ED8063, 3 | BRF_GRA},   // 4
    {"svc-c4.bin", 0x800000, 0x250BDE2D, 3 | BRF_GRA},   // 5
    {"svc-c5.bin", 0x800000, 0x9817C082, 3 | BRF_GRA},   // 6
    {"svc-c6.bin", 0x800000, 0x2BC0307F, 3 | BRF_GRA},   // 7
    {"svc-c7.bin", 0x800000, 0x4358D7B9, 3 | BRF_GRA},   // 8
    {"svc-c8.bin", 0x800000, 0x366DEEE5, 3 | BRF_GRA},   // 9

    {"svc-m1.bin", 0x020000, 0x804328C3, 4 | BRF_ESS | BRF_PRG},   // 10 Z80 code

    {"svc-v2.bin", 0x400000, 0xB5097287, 5 | BRF_SND},   // 11
    {"svc-v1.bin", 0x400000, 0xBD3A391F, 5 | BRF_SND},   // 12 Sound data
    {"svc-v4.bin", 0x400000, 0x33FC0B37, 5 | BRF_SND},   // 13
    {"svc-v3.bin", 0x400000, 0xAA9849A0, 5 | BRF_SND},   // 14
};

STDROMPICKEXT(svcboot, svcboot, neogeo);
STD_ROM_FN(svcboot);

static void svcboot_c()
{
  const unsigned char idx_tbl[ 0x10 ] = {
       0, 1, 0, 1, 2, 3, 2, 3, 3, 4, 3, 4, 4, 5, 4, 5,
    };

   const unsigned char bitswap4_tbl[ 6 ][ 4 ] = {
      { 3, 0, 1, 2 },
      { 2, 3, 0, 1 },
      { 1, 2, 3, 0 },
      { 0, 1, 2, 3 },
      { 3, 2, 1, 0 },
      { 3, 0, 2, 1 },
    };

   int i,ofst,crom_size = 0x4000000;
   UINT8 *crom = NeoSpriteROM;
   UINT8 *buf = (UINT8*)malloc(crom_size);

   memcpy( buf, crom, crom_size );

   for( i = 0; i < crom_size / 0x80; i++ ){
      int idx = idx_tbl[ (i & 0xf00) >> 8 ];

      int bit0 = bitswap4_tbl[ idx ][ 0 ];
      int bit1 = bitswap4_tbl[ idx ][ 1 ];
      int bit2 = bitswap4_tbl[ idx ][ 2 ];
      int bit3 = bitswap4_tbl[ idx ][ 3 ];

      ofst = BITSWAP08( (i & 0x0000ff), 7, 6, 5, 4, bit3, bit2, bit1, bit0 );
      ofst += (i & 0xfffff00);

      memcpy( &crom[ i * 0x80 ], &buf[ ofst * 0x80 ], 0x80 );
   }

   free( buf );

  // nSaveBootlegDecryptedC = 1; //for saving decrypted Sprite data 保存解密的盗版图像文件
}

static void svcboot_mx_decrypt()
{
   UINT8 *mrom = (UINT8 *)(NeoZ80ROM);
   UINT8 *dst = (UINT8*)malloc(0x20000);
   memcpy( dst+0x00000, mrom+0x10000, 0x10000 );
   memcpy( dst+0x10000, mrom+0x00000, 0x10000 );
   memcpy( mrom,dst,0x20000 );
   free(dst);

          //声音文件位交换
       nADPCMByteswap = 2;
}

static void svcboot_decrypt()
{
   const unsigned char sec[] = {0x06, 0x07, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00};

   int i,ofst,rom_size = 0x800000;

   UINT8 *rom = (UINT8*)(Neo68KROM);
   UINT8 *buf = (UINT8*)malloc(rom_size);

    for( i = 0; i < rom_size / 0x100000; i++ ){
      memcpy( &buf[ i * 0x100000 ], &rom[ sec[ i ] * 0x100000 ], 0x100000 );
    }

    for( i = 0; i < rom_size / 2; i++ ){
      ofst = BITSWAP08( (i & 0x0000ff), 7, 6, 1, 0, 3, 2, 5, 4 );
      ofst += (i & 0xffff00);
       memcpy( &rom[ i * 2 ], &buf[ ofst * 2 ], 0x02 );
    }

   free(buf);
   
   svcboot_mx_decrypt();
   
   svcboot_c();
}

static int svcbootInit()
{
   pNeoInitCallback=svcboot_decrypt;
   
   nNeoTextROMFixType=3;
   
  memset(CartRAM,0,sizeof(CartRAM));
 
  int nRet=NeoInit();
  if(!nRet)
      mv0_BankMapHandler();
   return nRet;
}

struct BurnDriver BurnDrvsvcboot= {
   "svcboot",NULL, "neogeo", "2003",
   "SvC Chaos: SNK vs Capcom (bootleg)\0格斗之王对街头霸王:混沌版 (盗版)\0图像、声音盗版加密\0",NULL,"SNK Playmore公司", "Neo Geo",
   NULL, NULL, NULL, NULL,
  BDF_GAME_WORKING | BDF_BOOTLEG, 2, HARDWARE_SNK_NEOGEO | HARDWARE_SNK_CUSTOM_BANKING | HARDWARE_SNK_SRAM,
  NULL, svcbootRomInfo, svcbootRomName, neogeoInputInfo, neogeoDIPInfo,
  svcbootInit, NeoExit, NeoFrame, NeoRender, NeoScan, &NeoRecalcPalette,
  nNeoScreenWidth, 224, 4, 3
};


// SvC Chaos: SNK vs Capcom Super Plus! (hack) 格斗之王对街头霸王:混沌版超级加强 (盗版)

static struct BurnRomInfo svcsplusRomDesc[] = {
    {"svc-p1sp.bin",0x400000, 0x2601902F, 1 | BRF_ESS | BRF_PRG},   // 0 68K code
    {"svc-p2sp.bin",0x400000, 0x0CA13305, 1 | BRF_ESS | BRF_PRG},   // 1

    {"svc-s1sp.bin",0x020000, 0x233D6439, 2 | BRF_GRA},   // 2

    {"svc-c1.bin",  0x800000, 0xA7826B89, 3 | BRF_GRA},   // 3 Sprite data
    {"svc-c2.bin",  0x800000, 0xED3C2089, 3 | BRF_GRA},   // 4
    {"svc-c3.bin",  0x800000, 0x71ED8063, 3 | BRF_GRA},   // 5
    {"svc-c4.bin",  0x800000, 0x250BDE2D, 3 | BRF_GRA},   // 6
    {"svc-c5.bin",  0x800000, 0x9817C082, 3 | BRF_GRA},   // 7
    {"svc-c6.bin",  0x800000, 0x2BC0307F, 3 | BRF_GRA},   // 8
    {"svc-c7.bin",  0x800000, 0x4358D7B9, 3 | BRF_GRA},   // 9
    {"svc-c8.bin",  0x800000, 0x366DEEE5, 3 | BRF_GRA},   // 10

    {"svc-m1.bin",  0x020000, 0x804328C3, 4 | BRF_ESS | BRF_PRG},   // 11 Z80 code

    {"svc-v2.bin",  0x400000, 0xB5097287, 5 | BRF_SND},   // 12
    {"svc-v1.bin",  0x400000, 0xBD3A391F, 5 | BRF_SND},   // 13 Sound data
    {"svc-v4.bin",  0x400000, 0x33FC0B37, 5 | BRF_SND},   // 14
    {"svc-v3.bin",  0x400000, 0xAA9849A0, 5 | BRF_SND},   // 15
};

STDROMPICKEXT(svcsplus, svcsplus, neogeo);
STD_ROM_FN(svcsplus);

static void svcsplus_decrypt()
{
   int sec[] = {0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x00, 0x07};
   int sed[] = {0x000000,0x700000,0x100000,0x200000,0x300000,0x400000,0x500000};

   unsigned char *src = Neo68KROM;
   int i,ofst,size = 0x800000;
   unsigned char *dst = (unsigned char*)malloc(size);

   memcpy( dst, src, size );

   for( i = 0; i < size / 2; i++ )   {
      ofst = BITSWAP16( (i & 0x007fff), 0x0f, 0x00, 0x08, 0x09, 0x0b, 0x0a, 0x0c, 0x0d,
                    0x04, 0x03, 0x01, 0x07, 0x06, 0x02, 0x05, 0x0e );

           ofst += (i & 0x078000);
           ofst += sec[ (i & 0xf80000) >> 19 ]

Sho:
pigcat, netbug

thanks you very much, i want this for a long time,

Navigation

[0] Message Index

[#] Next page

Go to full version