Skip to content

Commit

Permalink
Corrected NTSC Palette. Fixed input for games like Montezuma's Reveng…
Browse files Browse the repository at this point in the history
…e. Added many more games to the compatibility table.
  • Loading branch information
wavemotion-dave committed Dec 26, 2020
1 parent 910e8f1 commit 19183f5
Show file tree
Hide file tree
Showing 6 changed files with 205 additions and 606 deletions.
Binary file modified A5200DS.nds
Binary file not shown.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=1.8
VERSION=1.8a

#---------------------------------------------------------------------------------
.SUFFIXES:
Expand Down
161 changes: 74 additions & 87 deletions arm9/source/a5200utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,86 +301,73 @@ void VsoundHandler(void)
targetIndex=(targetIndex + 1) % 368;
}

const unsigned int palette_ntsc[256] = {
0x000000, 0x1c1c1c, 0x393939, 0x595959, // 1
0x797979, 0x929292, 0xababab, 0xbcbcbc,
0xcdcdcd, 0xd9d9d9, 0xe6e6e6, 0xececec,
0xf2f2f2, 0xf8f8f8, 0xffffff, 0xffffff,

0x391701, 0x5e2304, 0x833008, 0xa54716, // 2
0xc85f24, 0xe37820, 0xff911d, 0xffab1d,
0xffc51d, 0xffce34, 0xffd84c, 0xffe651,
0xfff456, 0xfff977, 0xffff98, 0xffff98,

0x451904, 0x721e11, 0x9f241e, 0xb33a20, // 3
0xc85122, 0xe36920, 0xff811e, 0xff8c25,
0xff982c, 0xffae38, 0xffc545, 0xffc559,
0xffc66d, 0xffd587, 0xffe4a1, 0xffe4a1,

0x4a1704, 0x7e1a0d, 0xb21d17, 0xc82119, // 4
0xdf251c, 0xec3b38, 0xfa5255, 0xfc6161,
0xff706e, 0xff7f7e, 0xff8f8f, 0xff9d9e,
0xffabad, 0xffb9bd, 0xffc7ce, 0xffc7ce,

0x050568, 0x3b136d, 0x912640, 0x912640, // 5
0xa532a6, 0xb938ba, 0xcd3ecf, 0xdb47dd,
0xea51eb, 0xf45ff5, 0xfe6dff, 0xfe7afd,
0xff87fb, 0xff95fd, 0xffa4ff, 0xffa4ff,

0x280479, 0x400984, 0x590f90, 0x70249d, // 6
0x8839aa, 0xa441c3, 0xc04adc, 0xd054ed,
0xe05eff, 0xe96dff, 0xf27cff, 0xf88aff,
0xff98ff, 0xfea1ff, 0xfeabff, 0xfeabff,

0x35088a, 0x420aad, 0x500cd0, 0x6428d0, // 7
0x7945d0, 0x8d4bd4, 0xa251d9, 0xb058ec,
0xbe60ff, 0xc56bff, 0xcc77ff, 0xd183ff,
0xd790ff, 0xdb9dff, 0xdfaaff, 0xdfaaff,

0x051e81, 0x0626a5, 0x082fca, 0x263dd4, // 8
0x444cde, 0x4f5aee, 0x5a68ff, 0x6575ff,
0x7183ff, 0x8091ff, 0x90a0ff, 0x97a9ff,
0x9fb2ff, 0xafbeff, 0xc0cbff, 0xc0cbff,

0x0c048b, 0x2218a0, 0x382db5, 0x483ec7, // 9
0x584fda, 0x6159ec, 0x6b64ff, 0x7a74ff,
0x8a84ff, 0x918eff, 0x9998ff, 0xa5a3ff,
0xb1aeff, 0xb8b8ff, 0xc0c2ff, 0xc0c2ff,

0x1d295a, 0x1d3876, 0x1d4892, 0x1c5cac, // 10
0x1c71c6, 0x3286cf, 0x489bd9, 0x4ea8ec,
0x55b6ff, 0x70c7ff, 0x8cd8ff, 0x93dbff,
0x9bdfff, 0xafe4ff, 0xc3e9ff, 0xc3e9ff,

0x2f4302, 0x395202, 0x446103, 0x417a12, // 11
0x3e9421, 0x4a9f2e, 0x57ab3b, 0x5cbd55,
0x61d070, 0x69e27a, 0x72f584, 0x7cfa8d,
0x87ff97, 0x9affa6, 0xadffb6, 0xadffb6,

0x0a4108, 0x0d540a, 0x10680d, 0x137d0f, // 12
0x169212, 0x19a514, 0x1cb917, 0x1ec919,
0x21d91b, 0x47e42d, 0x6ef040, 0x78f74d,
0x83ff5b, 0x9aff7a, 0xb2ff9a, 0xb2ff9a,

0x04410b, 0x05530e, 0x066611, 0x077714, // 13
0x088817, 0x099b1a, 0x0baf1d, 0x48c41f,
0x86d922, 0x8fe924, 0x99f927, 0xa8fc41,
0xb7ff5b, 0xc9ff6e, 0xdcff81, 0xdcff81,

0x02350f, 0x073f15, 0x0c4a1c, 0x2d5f1e, // 14
0x4f7420, 0x598324, 0x649228, 0x82a12e,
0xa1b034, 0xa9c13a, 0xb2d241, 0xc4d945,
0xd6e149, 0xe4f04e, 0xf2ff53, 0xf2ff53,

0x263001, 0x243803, 0x234005, 0x51541b, // 15
0x806931, 0x978135, 0xaf993a, 0xc2a73e,
0xd5b543, 0xdbc03d, 0xe1cb38, 0xe2d836,
0xe3e534, 0xeff258, 0xfbff7d, 0xfbff7d,

0x401a02, 0x581f05, 0x702408, 0x8d3a13, // 16
0xab511f, 0xb56427, 0xbf7730, 0xd0853a,
0xe19344, 0xeda04e, 0xf9ad58, 0xfcb75c,
0xffc160, 0xffc671, 0xffcb83, 0xffcb83
#define PALETTE_SIZE 768

byte palette_data[PALETTE_SIZE] = {
0x00,0x00,0x00,0x25,0x25,0x25,0x34,0x34,0x34,0x4F,0x4F,0x4F,
0x5B,0x5B,0x5B,0x69,0x69,0x69,0x7B,0x7B,0x7B,0x8A,0x8A,0x8A,
0xA7,0xA7,0xA7,0xB9,0xB9,0xB9,0xC5,0xC5,0xC5,0xD0,0xD0,0xD0,
0xD7,0xD7,0xD7,0xE1,0xE1,0xE1,0xF4,0xF4,0xF4,0xFF,0xFF,0xFF,
0x4C,0x32,0x00,0x62,0x3A,0x00,0x7B,0x4A,0x00,0x9A,0x60,0x00,
0xB5,0x74,0x00,0xCC,0x85,0x00,0xE7,0x9E,0x08,0xF7,0xAF,0x10,
0xFF,0xC3,0x18,0xFF,0xD0,0x20,0xFF,0xD8,0x28,0xFF,0xDF,0x30,
0xFF,0xE6,0x3B,0xFF,0xF4,0x40,0xFF,0xFA,0x4B,0xFF,0xFF,0x50,
0x99,0x25,0x00,0xAA,0x25,0x00,0xB4,0x25,0x00,0xD3,0x30,0x00,
0xDD,0x48,0x02,0xE2,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,0x79,0xFF,0xEA,0x98
};


Expand Down Expand Up @@ -418,13 +405,13 @@ void dsLoadGame(char *filename) {

// Init palette
for(index = 0; index < 256; index++) {
unsigned short r = ((palette_ntsc[index]& 0x00ff0000) >> 19);
unsigned short g = ((palette_ntsc[index]& 0x0000ff00) >> 11);
unsigned short b = ((palette_ntsc[index]& 0x000000ff) >> 3);
BG_PALETTE[index] = RGB15(r, g, b);
unsigned short r = palette_data[(index * 3) + 0];
unsigned short g = palette_data[(index * 3) + 1];
unsigned short b = palette_data[(index * 3) + 2];
BG_PALETTE[index] = RGB8(r, g, b);
atari_pal16[index] = index;
}

psound_buffer=sound_buffer;
TIMER2_DATA = TIMER_FREQ(22050);
TIMER2_CR = TIMER_DIV_1 | TIMER_IRQ_REQ | TIMER_ENABLE;
Expand Down Expand Up @@ -612,7 +599,7 @@ unsigned int dsWaitForRom(void) {
else {
ucBas = 0;
}
if (keysCurrent() & KEY_R) {
if ((keysCurrent() & KEY_R) || (keysCurrent() & KEY_RIGHT)) {
if (!ucSBas) {
ucFicAct = (ucFicAct< counta5200-nbRomPerPage ? ucFicAct+nbRomPerPage : counta5200-nbRomPerPage);
if (firstRomDisplay<counta5200-nbRomPerPage) { firstRomDisplay += nbRomPerPage; }
Expand All @@ -629,7 +616,7 @@ unsigned int dsWaitForRom(void) {
else {
ucSBas = 0;
}
if (keysCurrent() & KEY_L) {
if ((keysCurrent() & KEY_L) || (keysCurrent() & KEY_LEFT)) {
if (!ucSHaut) {
ucFicAct = (ucFicAct> nbRomPerPage ? ucFicAct-nbRomPerPage : 0);
if (firstRomDisplay>nbRomPerPage) { firstRomDisplay -= nbRomPerPage; }
Expand Down
7 changes: 5 additions & 2 deletions arm9/source/emu/atari_nds.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,11 @@ void Atari_Initialise(void) {
Sound_Initialise();
#endif

trig0 = 1;
stick0 = 15;
trig0 = 1; // Not pressed
trig1 = 1; // Not pressed
stick0 = STICK_CENTRE;
stick1 = STICK_CENTRE;

key_consol = CONSOL_NONE;
}

Expand Down
Loading

0 comments on commit 19183f5

Please sign in to comment.