Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int GetCharacterIndex(int value)
- {
- int highbyte = 0x99;
- int lowbyte = 0x40;
- if (value > 0x993F)
- {
- if ((value & 0xFF) < 0x40)
- {
- value -= 0x43;
- }
- highbyte = value >> 8;
- lowbyte = value & 0xFF;
- if (highbyte >= 0xE0) highbyte -= 0x40;
- }
- highbyte -= 0x99;
- if (lowbyte >= 0x80) lowbyte--;
- if (lowbyte >= 0x5D) lowbyte--;
- lowbyte -= 0x40;
- return (highbyte * 0xBB) + lowbyte;
- }
- void CreateTable(char* InputName, char* OutputName)
- {
- FILE* Tbl = fopen(OutputName,"wb");
- unsigned char* Sjis = NULL;
- int SjisAmount = ReadFileToBuffer(InputName,&Sjis) / 2;
- for (int i = 0x9940; i < 0xFFFF; i++)
- {
- int index = GetCharacterIndex(i);
- if (index < SjisAmount)
- {
- fprintf(Tbl,"%02X%02X=%c%c\n",i >> 8,i&0xFF,Sjis[index*2+0],Sjis[index*2+1]);
- }
- }
- fclose(Tbl);
- free(Sjis);
- }
Add Comment
Please, Sign In to add comment