mirror of https://github.com/snes9xgit/snes9x.git
Merge branch 'bsxrebase' of git://github.com/LuigiBlood/snes9x
This commit is contained in:
commit
51dfeeac9e
434
bsx.cpp
434
bsx.cpp
|
@ -218,6 +218,10 @@
|
||||||
|
|
||||||
struct SBSX_RTC
|
struct SBSX_RTC
|
||||||
{
|
{
|
||||||
|
int year;
|
||||||
|
int month;
|
||||||
|
int dayweek;
|
||||||
|
int day;
|
||||||
int hours;
|
int hours;
|
||||||
int minutes;
|
int minutes;
|
||||||
int seconds;
|
int seconds;
|
||||||
|
@ -893,6 +897,105 @@ void S9xSetBSX (uint8 byte, uint32 address)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void S9xBSXSetStream1 (uint8 count)
|
||||||
|
{
|
||||||
|
if (BSX.sat_stream1.is_open()) BSX.sat_stream1.close(); //If Stream1 already opened for one file: Close it.
|
||||||
|
|
||||||
|
char path[PATH_MAX + 1], name[PATH_MAX + 1];
|
||||||
|
|
||||||
|
strcpy(path, S9xGetDirectory(SAT_DIR));
|
||||||
|
strcat(path, SLASH_STR);
|
||||||
|
|
||||||
|
snprintf(name, PATH_MAX + 1, "BSX%04X-%d.bin", (BSX.PPU[0x2188 - BSXPPUBASE] | (BSX.PPU[0x2189 - BSXPPUBASE] * 256)), count); //BSXHHHH-DDD.bin
|
||||||
|
strcat(path, name);
|
||||||
|
|
||||||
|
BSX.sat_stream1.clear();
|
||||||
|
BSX.sat_stream1.open(path, std::ios::in | std::ios::binary);
|
||||||
|
if (BSX.sat_stream1.good())
|
||||||
|
{
|
||||||
|
BSX.sat_stream1.seekg(0, BSX.sat_stream1.end);
|
||||||
|
long str1size = BSX.sat_stream1.tellg();
|
||||||
|
BSX.sat_stream1.seekg(0, BSX.sat_stream1.beg);
|
||||||
|
float QueueSize = str1size / 22.;
|
||||||
|
BSX.PPU[0x218A - BSXPPUBASE] = (uint8)(ceil(QueueSize));
|
||||||
|
BSX.PPU[0x218D - BSXPPUBASE] = 0;
|
||||||
|
BSX.sat_stream1_first = TRUE;
|
||||||
|
BSX.sat_stream1_loaded = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BSX.sat_stream1_loaded = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void S9xBSXSetStream2 (uint8 count)
|
||||||
|
{
|
||||||
|
if (BSX.sat_stream2.is_open()) BSX.sat_stream2.close(); //If Stream1 already opened for one file: Close it.
|
||||||
|
|
||||||
|
char path[PATH_MAX + 1], name[PATH_MAX + 1];
|
||||||
|
|
||||||
|
strcpy(path, S9xGetDirectory(SAT_DIR));
|
||||||
|
strcat(path, SLASH_STR);
|
||||||
|
|
||||||
|
snprintf(name, PATH_MAX + 1, "BSX%04X-%d.bin", (BSX.PPU[0x218E - BSXPPUBASE] | (BSX.PPU[0x218F - BSXPPUBASE] * 256)), count); //BSXHHHH-DDD.bin
|
||||||
|
strcat(path, name);
|
||||||
|
|
||||||
|
BSX.sat_stream2.clear();
|
||||||
|
BSX.sat_stream2.open(path, std::ios::in | std::ios::binary);
|
||||||
|
if (BSX.sat_stream2.good())
|
||||||
|
{
|
||||||
|
BSX.sat_stream2.seekg(0, BSX.sat_stream2.end);
|
||||||
|
long str2size = BSX.sat_stream2.tellg();
|
||||||
|
BSX.sat_stream2.seekg(0, BSX.sat_stream2.beg);
|
||||||
|
float QueueSize = str2size / 22.;
|
||||||
|
BSX.PPU[0x2190 - BSXPPUBASE] = (uint8)(ceil(QueueSize));
|
||||||
|
BSX.PPU[0x2193 - BSXPPUBASE] = 0;
|
||||||
|
BSX.sat_stream2_first = TRUE;
|
||||||
|
BSX.sat_stream2_loaded = TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BSX.sat_stream2_loaded = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8 S9xBSXGetRTC (void)
|
||||||
|
{
|
||||||
|
//Get Time
|
||||||
|
time_t t;
|
||||||
|
struct tm *tmr;
|
||||||
|
|
||||||
|
time(&t);
|
||||||
|
tmr = localtime(&t);
|
||||||
|
|
||||||
|
BSX.test2192[0] = 0x00;
|
||||||
|
BSX.test2192[1] = 0x00;
|
||||||
|
BSX.test2192[2] = 0x00;
|
||||||
|
BSX.test2192[3] = 0x00;
|
||||||
|
BSX.test2192[4] = 0x10;
|
||||||
|
BSX.test2192[5] = 0x01;
|
||||||
|
BSX.test2192[6] = 0x01;
|
||||||
|
BSX.test2192[7] = 0x00;
|
||||||
|
BSX.test2192[8] = 0x00;
|
||||||
|
BSX.test2192[9] = 0x00;
|
||||||
|
BSX.test2192[10] = BSX_RTC.seconds = tmr->tm_sec;
|
||||||
|
BSX.test2192[11] = BSX_RTC.minutes = tmr->tm_min;
|
||||||
|
BSX.test2192[12] = BSX_RTC.hours = tmr->tm_hour;
|
||||||
|
BSX.test2192[13] = BSX_RTC.dayweek = (tmr->tm_wday) + 1;
|
||||||
|
BSX.test2192[14] = BSX_RTC.day = tmr->tm_mday;
|
||||||
|
BSX.test2192[15] = BSX_RTC.month = (tmr->tm_mon) + 1;
|
||||||
|
BSX_RTC.year = tmr->tm_year + 1900;
|
||||||
|
BSX.test2192[16] = (BSX_RTC.year) & 0xFF;
|
||||||
|
BSX.test2192[17] = (BSX_RTC.year) >> 8;
|
||||||
|
|
||||||
|
t = BSX.test2192[BSX.out_index++];
|
||||||
|
|
||||||
|
if (BSX.out_index > 22)
|
||||||
|
BSX.out_index = 0;
|
||||||
|
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
uint8 S9xGetBSXPPU (uint16 address)
|
uint8 S9xGetBSXPPU (uint16 address)
|
||||||
{
|
{
|
||||||
uint8 t;
|
uint8 t;
|
||||||
|
@ -900,95 +1003,255 @@ uint8 S9xGetBSXPPU (uint16 address)
|
||||||
// known read registers
|
// known read registers
|
||||||
switch (address)
|
switch (address)
|
||||||
{
|
{
|
||||||
// Test register low? (r/w)
|
//Stream 1
|
||||||
|
// Logical Channel 1 + Data Structure (R/W)
|
||||||
case 0x2188:
|
case 0x2188:
|
||||||
t = BSX.PPU[0x2188 - BSXPPUBASE];
|
t = BSX.PPU[0x2188 - BSXPPUBASE];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Test register high? (r/w)
|
// Logical Channel 2 (R/W) [6bit]
|
||||||
case 0x2189:
|
case 0x2189:
|
||||||
t = BSX.PPU[0x2189 - BSXPPUBASE];
|
t = BSX.PPU[0x2189 - BSXPPUBASE];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Prefix Count (R)
|
||||||
case 0x218A:
|
case 0x218A:
|
||||||
|
if (!BSX.sat_pf_latch1_enable || !BSX.sat_dt_latch1_enable)
|
||||||
|
{
|
||||||
|
t = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BSX.PPU[0x2188 - BSXPPUBASE] == 0 && BSX.PPU[0x2189 - BSXPPUBASE] == 0)
|
||||||
|
{
|
||||||
|
t = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BSX.PPU[0x218A - BSXPPUBASE] <= 0)
|
||||||
|
{
|
||||||
|
BSX.sat_stream1_count++;
|
||||||
|
S9xBSXSetStream1(BSX.sat_stream1_count - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!BSX.sat_stream1_loaded && (BSX.sat_stream1_count - 1) > 0)
|
||||||
|
{
|
||||||
|
BSX.sat_stream1_count = 1;
|
||||||
|
S9xBSXSetStream1(BSX.sat_stream1_count - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BSX.sat_stream1_loaded)
|
||||||
t = BSX.PPU[0x218A - BSXPPUBASE];
|
t = BSX.PPU[0x218A - BSXPPUBASE];
|
||||||
|
else
|
||||||
|
t = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Prefix Latch (R/W)
|
||||||
|
case 0x218B:
|
||||||
|
if (BSX.sat_pf_latch1_enable)
|
||||||
|
{
|
||||||
|
if (BSX.PPU[0x2188 - BSXPPUBASE] == 0 && BSX.PPU[0x2189 - BSXPPUBASE] == 0)
|
||||||
|
{
|
||||||
|
BSX.PPU[0x218B - BSXPPUBASE] = 0x90;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BSX.sat_stream1_loaded)
|
||||||
|
{
|
||||||
|
uint8 temp = 0;
|
||||||
|
if (BSX.sat_stream1_first)
|
||||||
|
{
|
||||||
|
// First packet
|
||||||
|
temp |= 0x10;
|
||||||
|
BSX.sat_stream1_first = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BSX.PPU[0x218A - BSXPPUBASE]--;
|
||||||
|
|
||||||
|
if (BSX.PPU[0x218A - BSXPPUBASE] == 0)
|
||||||
|
{
|
||||||
|
//Last packet
|
||||||
|
temp |= 0x80;
|
||||||
|
}
|
||||||
|
|
||||||
|
BSX.PPU[0x218B - BSXPPUBASE] = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
BSX.PPU[0x218D - BSXPPUBASE] |= BSX.PPU[0x218B - BSXPPUBASE];
|
||||||
|
t = BSX.PPU[0x218B - BSXPPUBASE];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
t = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Data Latch (R/W)
|
||||||
case 0x218C:
|
case 0x218C:
|
||||||
|
if (BSX.sat_dt_latch1_enable)
|
||||||
|
{
|
||||||
|
if (BSX.PPU[0x2188 - BSXPPUBASE] == 0 && BSX.PPU[0x2189 - BSXPPUBASE] == 0)
|
||||||
|
{
|
||||||
|
BSX.PPU[0x218C - BSXPPUBASE] = S9xBSXGetRTC();
|
||||||
|
}
|
||||||
|
else if (BSX.sat_stream1_loaded)
|
||||||
|
{
|
||||||
|
if (BSX.sat_stream1.eof())
|
||||||
|
BSX.PPU[0x218C - BSXPPUBASE] = 0xFF;
|
||||||
|
else
|
||||||
|
BSX.PPU[0x218C - BSXPPUBASE] = BSX.sat_stream1.get();
|
||||||
|
}
|
||||||
t = BSX.PPU[0x218C - BSXPPUBASE];
|
t = BSX.PPU[0x218C - BSXPPUBASE];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
t = 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Transmission number low? (r/w)
|
// OR gate (R)
|
||||||
|
case 0x218D:
|
||||||
|
t = BSX.PPU[0x218D - BSXPPUBASE];
|
||||||
|
BSX.PPU[0x218D - BSXPPUBASE] = 0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
//Stream 2
|
||||||
|
// Logical Channel 1 + Data Structure (R/W)
|
||||||
case 0x218E:
|
case 0x218E:
|
||||||
t = BSX.PPU[0x218E - BSXPPUBASE];
|
t = BSX.PPU[0x218E - BSXPPUBASE];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Transmission number high? (r/w)
|
// Logical Channel 2 (R/W) [6bit]
|
||||||
case 0x218F:
|
case 0x218F:
|
||||||
t = BSX.PPU[0x218F - BSXPPUBASE];
|
t = BSX.PPU[0x218F - BSXPPUBASE];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Status register? (r)
|
// Prefix Count (R)
|
||||||
case 0x2190:
|
case 0x2190:
|
||||||
|
if (!BSX.sat_pf_latch2_enable || !BSX.sat_dt_latch2_enable)
|
||||||
|
{
|
||||||
|
t = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BSX.PPU[0x218E - BSXPPUBASE] == 0 && BSX.PPU[0x218F - BSXPPUBASE] == 0)
|
||||||
|
{
|
||||||
|
t = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BSX.PPU[0x2190 - BSXPPUBASE] <= 0)
|
||||||
|
{
|
||||||
|
BSX.sat_stream2_count++;
|
||||||
|
S9xBSXSetStream2(BSX.sat_stream2_count - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!BSX.sat_stream2_loaded && (BSX.sat_stream2_count - 1) > 0)
|
||||||
|
{
|
||||||
|
BSX.sat_stream2_count = 1;
|
||||||
|
S9xBSXSetStream2(BSX.sat_stream2_count - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BSX.sat_stream2_loaded)
|
||||||
t = BSX.PPU[0x2190 - BSXPPUBASE];
|
t = BSX.PPU[0x2190 - BSXPPUBASE];
|
||||||
|
else
|
||||||
|
t = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Data register? (r/w)
|
// Prefix Latch (R/W)
|
||||||
|
case 0x2191:
|
||||||
|
if (BSX.sat_pf_latch2_enable)
|
||||||
|
{
|
||||||
|
if (BSX.PPU[0x218E - BSXPPUBASE] == 0 && BSX.PPU[0x218F - BSXPPUBASE] == 0)
|
||||||
|
{
|
||||||
|
BSX.PPU[0x2191 - BSXPPUBASE] = 0x90;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (BSX.sat_stream2_loaded)
|
||||||
|
{
|
||||||
|
uint8 temp = 0;
|
||||||
|
if (BSX.sat_stream2_first)
|
||||||
|
{
|
||||||
|
// First packet
|
||||||
|
temp |= 0x10;
|
||||||
|
BSX.sat_stream2_first = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
BSX.PPU[0x2190 - BSXPPUBASE]--;
|
||||||
|
|
||||||
|
if (BSX.PPU[0x2190 - BSXPPUBASE] == 0)
|
||||||
|
{
|
||||||
|
//Last packet
|
||||||
|
temp |= 0x80;
|
||||||
|
}
|
||||||
|
|
||||||
|
BSX.PPU[0x2191 - BSXPPUBASE] = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
BSX.PPU[0x2193 - BSXPPUBASE] |= BSX.PPU[0x2191 - BSXPPUBASE];
|
||||||
|
t = BSX.PPU[0x2191 - BSXPPUBASE];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
t = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Data Latch (R/W)
|
||||||
case 0x2192:
|
case 0x2192:
|
||||||
// t = BSX.PPU[0x2192 - BSXPPUBASE];
|
if (BSX.sat_dt_latch2_enable)
|
||||||
|
|
||||||
// test
|
|
||||||
t = BSX.test2192[BSX.out_index++];
|
|
||||||
if (BSX.out_index == 32)
|
|
||||||
BSX.out_index = 0;
|
|
||||||
|
|
||||||
BSX_RTC.ticks++;
|
|
||||||
if (BSX_RTC.ticks >= 1000)
|
|
||||||
{
|
{
|
||||||
BSX_RTC.ticks = 0;
|
if (BSX.PPU[0x218E - BSXPPUBASE] == 0 && BSX.PPU[0x218F - BSXPPUBASE] == 0)
|
||||||
BSX_RTC.seconds++;
|
|
||||||
}
|
|
||||||
if (BSX_RTC.seconds >= 60)
|
|
||||||
{
|
{
|
||||||
BSX_RTC.seconds = 0;
|
BSX.PPU[0x2192 - BSXPPUBASE] = S9xBSXGetRTC();
|
||||||
BSX_RTC.minutes++;
|
|
||||||
}
|
}
|
||||||
if (BSX_RTC.minutes >= 60)
|
else if (BSX.sat_stream2_loaded)
|
||||||
{
|
{
|
||||||
BSX_RTC.minutes = 0;
|
if (BSX.sat_stream2.eof())
|
||||||
BSX_RTC.hours++;
|
BSX.PPU[0x2192 - BSXPPUBASE] = 0xFF;
|
||||||
|
else
|
||||||
|
BSX.PPU[0x2192 - BSXPPUBASE] = BSX.sat_stream2.get();
|
||||||
|
}
|
||||||
|
t = BSX.PPU[0x2192 - BSXPPUBASE];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
t = 0;
|
||||||
}
|
}
|
||||||
if (BSX_RTC.hours >= 24)
|
|
||||||
BSX_RTC.hours = 0;
|
|
||||||
|
|
||||||
BSX.test2192[10] = BSX_RTC.seconds;
|
|
||||||
BSX.test2192[11] = BSX_RTC.minutes;
|
|
||||||
BSX.test2192[12] = BSX_RTC.hours;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Transmission status? (r/w)
|
// OR gate (R)
|
||||||
case 0x2193:
|
case 0x2193:
|
||||||
// Data ready when bits 2/3 clear?
|
t = BSX.PPU[0x2193 - BSXPPUBASE];
|
||||||
t = BSX.PPU[0x2193 - BSXPPUBASE] & ~0x0C;
|
BSX.PPU[0x2193 - BSXPPUBASE] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Reset? (r/w)
|
//Other
|
||||||
|
// Satellaview LED / Stream Enable (R/W) [4bit]
|
||||||
case 0x2194:
|
case 0x2194:
|
||||||
t = BSX.PPU[0x2194 - BSXPPUBASE];
|
t = BSX.PPU[0x2194 - BSXPPUBASE];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Unknown (r)
|
// Unknown
|
||||||
|
case 0x2195:
|
||||||
|
t = BSX.PPU[0x2195 - BSXPPUBASE];
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Satellaview Status (R)
|
||||||
case 0x2196:
|
case 0x2196:
|
||||||
t = BSX.PPU[0x2196 - BSXPPUBASE];
|
t = BSX.PPU[0x2196 - BSXPPUBASE];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Unknown (r/w)
|
// Soundlink Settings (R/W)
|
||||||
case 0x2197:
|
case 0x2197:
|
||||||
t = BSX.PPU[0x2197 - BSXPPUBASE];
|
t = BSX.PPU[0x2197 - BSXPPUBASE];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Modem protocol? (r/w)
|
// Serial I/O - Serial Number (R/W)
|
||||||
|
case 0x2198:
|
||||||
|
t = BSX.PPU[0x2198 - BSXPPUBASE];
|
||||||
|
break;
|
||||||
|
|
||||||
|
// Serial I/O - Unknown (R/W)
|
||||||
case 0x2199:
|
case 0x2199:
|
||||||
t = BSX.PPU[0x2199 - BSXPPUBASE];
|
t = BSX.PPU[0x2199 - BSXPPUBASE];
|
||||||
break;
|
break;
|
||||||
|
@ -1006,78 +1269,82 @@ void S9xSetBSXPPU (uint8 byte, uint16 address)
|
||||||
// known write registers
|
// known write registers
|
||||||
switch (address)
|
switch (address)
|
||||||
{
|
{
|
||||||
// Test register low? (r/w)
|
//Stream 1
|
||||||
|
// Logical Channel 1 + Data Structure (R/W)
|
||||||
case 0x2188:
|
case 0x2188:
|
||||||
|
if (BSX.PPU[0x2188 - BSXPPUBASE] == byte)
|
||||||
|
{
|
||||||
|
BSX.sat_stream1_count = 0;
|
||||||
|
}
|
||||||
BSX.PPU[0x2188 - BSXPPUBASE] = byte;
|
BSX.PPU[0x2188 - BSXPPUBASE] = byte;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Test register high? (r/w)
|
// Logical Channel 2 (R/W) [6bit]
|
||||||
case 0x2189:
|
case 0x2189:
|
||||||
BSX.PPU[0x2189 - BSXPPUBASE] = byte;
|
if (BSX.PPU[0x2188 - BSXPPUBASE] == (byte & 0x3F))
|
||||||
break;
|
{
|
||||||
|
BSX.sat_stream1_count = 0;
|
||||||
case 0x218A:
|
}
|
||||||
BSX.PPU[0x218A - BSXPPUBASE] = byte;
|
BSX.PPU[0x2189 - BSXPPUBASE] = byte & 0x3F;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Prefix Latch (R/W)
|
||||||
case 0x218B:
|
case 0x218B:
|
||||||
BSX.PPU[0x218B - BSXPPUBASE] = byte;
|
BSX.sat_pf_latch1_enable = (byte != 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Data Latch (R/W)
|
||||||
case 0x218C:
|
case 0x218C:
|
||||||
BSX.PPU[0x218C - BSXPPUBASE] = byte;
|
if (BSX.PPU[0x2188 - BSXPPUBASE] == 0 && BSX.PPU[0x2189 - BSXPPUBASE] == 0)
|
||||||
|
{
|
||||||
|
BSX.out_index = 0;
|
||||||
|
}
|
||||||
|
BSX.sat_dt_latch1_enable = (byte != 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Transmission number low? (r/w)
|
//Stream 2
|
||||||
|
// Logical Channel 1 + Data Structure (R/W)
|
||||||
case 0x218E:
|
case 0x218E:
|
||||||
|
if (BSX.PPU[0x218E - BSXPPUBASE] == byte)
|
||||||
|
{
|
||||||
|
BSX.sat_stream2_count = 0;
|
||||||
|
}
|
||||||
BSX.PPU[0x218E - BSXPPUBASE] = byte;
|
BSX.PPU[0x218E - BSXPPUBASE] = byte;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Transmission number high? (r/w)
|
// Logical Channel 2 (R/W) [6bit]
|
||||||
case 0x218F:
|
case 0x218F:
|
||||||
BSX.PPU[0x218F - BSXPPUBASE] = byte;
|
if (BSX.PPU[0x218F - BSXPPUBASE] == (byte & 0x3F))
|
||||||
|
{
|
||||||
// ?
|
BSX.sat_stream2_count = 0;
|
||||||
BSX.PPU[0x218E - BSXPPUBASE] >>= 1;
|
}
|
||||||
BSX.PPU[0x218E - BSXPPUBASE] = BSX.PPU[0x218F - BSXPPUBASE] - BSX.PPU[0x218E - BSXPPUBASE];
|
BSX.PPU[0x218F - BSXPPUBASE] = byte & 0x3F;
|
||||||
BSX.PPU[0x218F - BSXPPUBASE] >>= 1;
|
|
||||||
|
|
||||||
BSX.PPU[0x2190 - BSXPPUBASE] = 0x80; // ?
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Strobe assert? (w)
|
// Prefix Latch (R/W)
|
||||||
case 0x2191:
|
case 0x2191:
|
||||||
BSX.PPU[0x2191 - BSXPPUBASE] = byte;
|
BSX.sat_pf_latch2_enable = (byte != 0);
|
||||||
BSX.out_index = 0;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Data register? (r/w)
|
// Data Latch (R/W)
|
||||||
case 0x2192:
|
case 0x2192:
|
||||||
BSX.PPU[0x2192 - BSXPPUBASE] = 0x01; // ?
|
if (BSX.PPU[0x218E - BSXPPUBASE] == 0 && BSX.PPU[0x218F - BSXPPUBASE] == 0)
|
||||||
BSX.PPU[0x2190 - BSXPPUBASE] = 0x80; // ?
|
{
|
||||||
|
BSX.out_index = 0;
|
||||||
|
}
|
||||||
|
BSX.sat_dt_latch2_enable = (byte != 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Transmission status? (r/w)
|
//Other
|
||||||
case 0x2193:
|
// Satellaview LED / Stream Enable (R/W) [4bit]
|
||||||
BSX.PPU[0x2193 - BSXPPUBASE] = byte;
|
|
||||||
break;
|
|
||||||
|
|
||||||
// Reset? (r/w)
|
|
||||||
case 0x2194:
|
case 0x2194:
|
||||||
BSX.PPU[0x2194 - BSXPPUBASE] = byte;
|
BSX.PPU[0x2194 - BSXPPUBASE] = byte & 0x0F;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Unknown (r/w)
|
// Soundlink Settings (R/W)
|
||||||
case 0x2197:
|
case 0x2197:
|
||||||
BSX.PPU[0x2197 - BSXPPUBASE] = byte;
|
BSX.PPU[0x2197 - BSXPPUBASE] = byte;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Modem protocol? (r/w)
|
|
||||||
case 0x2199:
|
|
||||||
// Lots of modem strings written here when
|
|
||||||
// connection is lost or no uplink established
|
|
||||||
BSX.PPU[0x2199 - BSXPPUBASE] = byte;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1196,7 +1463,7 @@ void S9xInitBSX (void)
|
||||||
{
|
{
|
||||||
MapROM = NULL;
|
MapROM = NULL;
|
||||||
FlashROM = Memory.ROM;
|
FlashROM = Memory.ROM;
|
||||||
|
/*
|
||||||
time_t t;
|
time_t t;
|
||||||
struct tm *tmr;
|
struct tm *tmr;
|
||||||
|
|
||||||
|
@ -1211,6 +1478,7 @@ void S9xInitBSX (void)
|
||||||
#ifdef BSX_DEBUG
|
#ifdef BSX_DEBUG
|
||||||
printf("BS: Current Time: %02d:%02d:%02d\n", BSX_RTC.hours, BSX_RTC.minutes, BSX_RTC.seconds);
|
printf("BS: Current Time: %02d:%02d:%02d\n", BSX_RTC.hours, BSX_RTC.minutes, BSX_RTC.seconds);
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
SNESGameFixes.SRAMInitialValue = 0x00;
|
SNESGameFixes.SRAMInitialValue = 0x00;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1243,6 +1511,14 @@ void S9xResetBSX (void)
|
||||||
BSX.MMC[0x07] = BSX.MMC[0x08] = 0x80;
|
BSX.MMC[0x07] = BSX.MMC[0x08] = 0x80;
|
||||||
BSX.MMC[0x0E] = 0x80;
|
BSX.MMC[0x0E] = 0x80;
|
||||||
|
|
||||||
|
// stream reset
|
||||||
|
BSX.sat_pf_latch1_enable, BSX.sat_dt_latch1_enable = FALSE;
|
||||||
|
BSX.sat_pf_latch2_enable, BSX.sat_dt_latch2_enable = FALSE;
|
||||||
|
|
||||||
|
BSX.sat_stream1_loaded, BSX.sat_stream2_loaded = FALSE;
|
||||||
|
BSX.sat_stream1_first, BSX.sat_stream2_first = FALSE;
|
||||||
|
BSX.sat_stream1_count, BSX.sat_stream2_count = 0;
|
||||||
|
|
||||||
BSX_Map();
|
BSX_Map();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
10
bsx.h
10
bsx.h
|
@ -213,6 +213,16 @@ struct SBSX
|
||||||
bool flash_gsr;
|
bool flash_gsr;
|
||||||
bool flash_bsr;
|
bool flash_bsr;
|
||||||
bool flash_cmd_done;
|
bool flash_cmd_done;
|
||||||
|
|
||||||
|
std::ifstream sat_stream1;
|
||||||
|
std::ifstream sat_stream2;
|
||||||
|
|
||||||
|
bool sat_pf_latch1_enable, sat_dt_latch1_enable;
|
||||||
|
bool sat_pf_latch2_enable, sat_dt_latch2_enable;
|
||||||
|
|
||||||
|
bool sat_stream1_loaded, sat_stream2_loaded;
|
||||||
|
bool sat_stream1_first, sat_stream2_first;
|
||||||
|
uint8 sat_stream1_count, sat_stream2_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct SBSX BSX;
|
extern struct SBSX BSX;
|
||||||
|
|
|
@ -207,6 +207,7 @@ enum s9x_getdirtype
|
||||||
IPS_DIR,
|
IPS_DIR,
|
||||||
BIOS_DIR,
|
BIOS_DIR,
|
||||||
LOG_DIR,
|
LOG_DIR,
|
||||||
|
SAT_DIR,
|
||||||
LAST_DIR
|
LAST_DIR
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -953,6 +953,7 @@ void WinRegisterConfigItems()
|
||||||
AddStringC("Dir:SRAM", GUI.SRAMFileDir, _MAX_PATH, ".\\Saves", "directory where battery saves will be created and loaded from");
|
AddStringC("Dir:SRAM", GUI.SRAMFileDir, _MAX_PATH, ".\\Saves", "directory where battery saves will be created and loaded from");
|
||||||
AddStringC("Dir:Patches", GUI.PatchDir, _MAX_PATH, ".\\Cheats", "directory in which ROM patches (.ips files) and cheats (.cht files) will be looked for");
|
AddStringC("Dir:Patches", GUI.PatchDir, _MAX_PATH, ".\\Cheats", "directory in which ROM patches (.ips files) and cheats (.cht files) will be looked for");
|
||||||
AddStringC("Dir:Bios", GUI.BiosDir, _MAX_PATH, ".\\BIOS", "directory where BIOS files (such as \"BS-X.bios\") will be located");
|
AddStringC("Dir:Bios", GUI.BiosDir, _MAX_PATH, ".\\BIOS", "directory where BIOS files (such as \"BS-X.bios\") will be located");
|
||||||
|
AddStringC("Dir:SatData", GUI.SatDir, _MAX_PATH, ".\\SatData", "directory where Satellaview Signal Data files will be located");
|
||||||
AddBoolC("Dir:Lock", GUI.LockDirectories, false, "true to prevent Snes9x from changing configured directories when you browse to a new location");
|
AddBoolC("Dir:Lock", GUI.LockDirectories, false, "true to prevent Snes9x from changing configured directories when you browse to a new location");
|
||||||
#define ADD(n) AddString("Rom:RecentGame" #n, GUI.RecentGames[n-1], MAX_PATH, "")
|
#define ADD(n) AddString("Rom:RecentGame" #n, GUI.RecentGames[n-1], MAX_PATH, "")
|
||||||
ADD(1); ADD(2); ADD(3); ADD(4); ADD(5); ADD(6); ADD(7); ADD(8);
|
ADD(1); ADD(2); ADD(3); ADD(4); ADD(5); ADD(6); ADD(7); ADD(8);
|
||||||
|
|
|
@ -353,6 +353,10 @@ const TCHAR *S9xGetDirectoryT (enum s9x_getdirtype dirtype)
|
||||||
rv = GUI.FreezeFileDir;
|
rv = GUI.FreezeFileDir;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SAT_DIR:
|
||||||
|
rv = GUI.SatDir;
|
||||||
|
break;
|
||||||
|
|
||||||
case ROMFILENAME_DIR: {
|
case ROMFILENAME_DIR: {
|
||||||
static TCHAR filename [PATH_MAX];
|
static TCHAR filename [PATH_MAX];
|
||||||
lstrcpy(filename, _tFromChar(Memory.ROMFilename));
|
lstrcpy(filename, _tFromChar(Memory.ROMFilename));
|
||||||
|
|
|
@ -580,6 +580,7 @@ Nintendo is a trade mark.")
|
||||||
#define SETTINGS_OPTION_DIRECTORY_SRAM TEXT("SRAM")
|
#define SETTINGS_OPTION_DIRECTORY_SRAM TEXT("SRAM")
|
||||||
#define SETTINGS_OPTION_DIRECTORY_PATCHESANDCHEATS TEXT("Patch&Cheat")
|
#define SETTINGS_OPTION_DIRECTORY_PATCHESANDCHEATS TEXT("Patch&Cheat")
|
||||||
#define SETTINGS_OPTION_DIRECTORY_BIOS TEXT("BIOS files")
|
#define SETTINGS_OPTION_DIRECTORY_BIOS TEXT("BIOS files")
|
||||||
|
#define SETTINGS_OPTION_DIRECTORY_SATDATA TEXT("Satellaview")
|
||||||
|
|
||||||
// Misc.
|
// Misc.
|
||||||
|
|
||||||
|
|
|
@ -5089,7 +5089,7 @@ INT_PTR CALLBACK DlgAboutProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
INT_PTR CALLBACK DlgEmulatorProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
INT_PTR CALLBACK DlgEmulatorProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
static TCHAR paths[8][MAX_PATH];
|
static TCHAR paths[9][MAX_PATH];
|
||||||
static int which = 0;
|
static int which = 0;
|
||||||
switch(msg)
|
switch(msg)
|
||||||
{
|
{
|
||||||
|
@ -5140,6 +5140,8 @@ INT_PTR CALLBACK DlgEmulatorProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar
|
||||||
SendDlgItemMessage(hDlg,IDC_DIRCOMBO,CB_ADDSTRING,0,(LPARAM)(LPCTSTR)SETTINGS_OPTION_DIRECTORY_PATCHESANDCHEATS);
|
SendDlgItemMessage(hDlg,IDC_DIRCOMBO,CB_ADDSTRING,0,(LPARAM)(LPCTSTR)SETTINGS_OPTION_DIRECTORY_PATCHESANDCHEATS);
|
||||||
lstrcpy(paths[inum++],GUI.BiosDir);
|
lstrcpy(paths[inum++],GUI.BiosDir);
|
||||||
SendDlgItemMessage(hDlg,IDC_DIRCOMBO,CB_ADDSTRING,0,(LPARAM)(LPCTSTR)SETTINGS_OPTION_DIRECTORY_BIOS);
|
SendDlgItemMessage(hDlg,IDC_DIRCOMBO,CB_ADDSTRING,0,(LPARAM)(LPCTSTR)SETTINGS_OPTION_DIRECTORY_BIOS);
|
||||||
|
lstrcpy(paths[inum++],GUI.SatDir);
|
||||||
|
SendDlgItemMessage(hDlg,IDC_DIRCOMBO,CB_ADDSTRING,0,(LPARAM)(LPCTSTR)SETTINGS_OPTION_DIRECTORY_SATDATA);
|
||||||
|
|
||||||
SendDlgItemMessage(hDlg,IDC_DIRCOMBO,CB_SETCURSEL,(WPARAM)0,0);
|
SendDlgItemMessage(hDlg,IDC_DIRCOMBO,CB_SETCURSEL,(WPARAM)0,0);
|
||||||
SetDlgItemText(hDlg, IDC_CUSTOM_FOLDER_FIELD, paths[0]);
|
SetDlgItemText(hDlg, IDC_CUSTOM_FOLDER_FIELD, paths[0]);
|
||||||
|
@ -5202,6 +5204,7 @@ INT_PTR CALLBACK DlgEmulatorProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar
|
||||||
lstrcpy(GUI.SRAMFileDir,paths[inum++]);
|
lstrcpy(GUI.SRAMFileDir,paths[inum++]);
|
||||||
lstrcpy(GUI.PatchDir,paths[inum++]);
|
lstrcpy(GUI.PatchDir,paths[inum++]);
|
||||||
lstrcpy(GUI.BiosDir,paths[inum++]);
|
lstrcpy(GUI.BiosDir,paths[inum++]);
|
||||||
|
lstrcpy(GUI.SatDir,paths[inum++]);
|
||||||
|
|
||||||
GUI.InactivePause = (BST_CHECKED==IsDlgButtonChecked(hDlg, IDC_INACTIVE_PAUSE));
|
GUI.InactivePause = (BST_CHECKED==IsDlgButtonChecked(hDlg, IDC_INACTIVE_PAUSE));
|
||||||
GUI.CustomRomOpen = (BST_CHECKED==IsDlgButtonChecked(hDlg, IDC_CUSTOMROMOPEN));
|
GUI.CustomRomOpen = (BST_CHECKED==IsDlgButtonChecked(hDlg, IDC_CUSTOMROMOPEN));
|
||||||
|
|
|
@ -394,6 +394,7 @@ struct sGUI {
|
||||||
TCHAR SRAMFileDir [_MAX_PATH];
|
TCHAR SRAMFileDir [_MAX_PATH];
|
||||||
TCHAR PatchDir [_MAX_PATH];
|
TCHAR PatchDir [_MAX_PATH];
|
||||||
TCHAR BiosDir [_MAX_PATH];
|
TCHAR BiosDir [_MAX_PATH];
|
||||||
|
TCHAR SatDir [_MAX_PATH];
|
||||||
bool LockDirectories;
|
bool LockDirectories;
|
||||||
|
|
||||||
TCHAR RecentGames [MAX_RECENT_GAMES_LIST_SIZE][MAX_PATH];
|
TCHAR RecentGames [MAX_RECENT_GAMES_LIST_SIZE][MAX_PATH];
|
||||||
|
|
Loading…
Reference in New Issue