mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
replace SI_DUMMY with SI_NONE, an actual null device.
tweak SI a little so that it doesn't block things which block on the status reg. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4713 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -7,28 +7,106 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <unistd.h>
|
||||
#include <fat.h>
|
||||
|
||||
#ifdef HW_RVL
|
||||
#include <wiiuse/wpad.h>
|
||||
#include <sdcard/wiisd_io.h>
|
||||
#endif
|
||||
|
||||
static void *xfb;
|
||||
static GXRModeObj *rmode;
|
||||
|
||||
void Initialise();
|
||||
void (*reboot)() = (void(*)())0x80001800;
|
||||
static u32* const SI_REG = (u32*)0xCD006400;
|
||||
static bool haveInit = false;
|
||||
static int counter = 0;
|
||||
static bool logWritten = false;
|
||||
|
||||
void AppendSDLog()
|
||||
{
|
||||
#ifdef HW_RVL
|
||||
FILE *f = fopen("sd:/si_log.txt", "a");
|
||||
if (f)
|
||||
{
|
||||
fprintf(f, "\n-------------------------------------\n");
|
||||
for (int i = 0; i < 4; i++)
|
||||
fprintf(f, "%i\tstatus: %x\t type:%x\n", i, SI_GetStatus(i), SI_GetType(i));
|
||||
u32 x = 0;
|
||||
fprintf(f, "-------------------------------------\n");
|
||||
fprintf(f, "SI_CHANNEL_0_OUT\t%08x\n", SI_REG[x++]);
|
||||
fprintf(f, "SI_CHANNEL_0_IN_HI\t%08x\n", SI_REG[x++]);
|
||||
fprintf(f, "SI_CHANNEL_0_IN_LO\t%08x\n", SI_REG[x++]);
|
||||
fprintf(f, "SI_CHANNEL_1_OUT\t%08x\n", SI_REG[x++]);
|
||||
fprintf(f, "SI_CHANNEL_1_IN_HI\t%08x\n", SI_REG[x++]);
|
||||
fprintf(f, "SI_CHANNEL_1_IN_LO\t%08x\n", SI_REG[x++]);
|
||||
fprintf(f, "SI_CHANNEL_2_OUT\t%08x\n", SI_REG[x++]);
|
||||
fprintf(f, "SI_CHANNEL_2_IN_HI\t%08x\n", SI_REG[x++]);
|
||||
fprintf(f, "SI_CHANNEL_2_IN_LO\t%08x\n", SI_REG[x++]);
|
||||
fprintf(f, "SI_CHANNEL_3_OUT\t%08x\n", SI_REG[x++]);
|
||||
fprintf(f, "SI_CHANNEL_3_IN_HI\t%08x\n", SI_REG[x++]);
|
||||
fprintf(f, "SI_CHANNEL_3_IN_LO\t%08x\n", SI_REG[x++]);
|
||||
fprintf(f, "SI_POLL\t\t\t%08x\n", SI_REG[x++]);
|
||||
fprintf(f, "SI_COM_CSR\t\t\t%08x\n", SI_REG[x++]);
|
||||
fprintf(f, "SI_STATUS_REG\t\t%08x\n", SI_REG[x++]);
|
||||
fprintf(f, "SI_EXI_CLOCK_COUNT\t%08x\n", SI_REG[x++]);
|
||||
fprintf(f, "-------------------------------------\n");
|
||||
fclose(f);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
Initialise();
|
||||
|
||||
while(1) {
|
||||
PAD_ScanPads();
|
||||
VIDEO_ClearFrameBuffer(rmode, xfb, 0);
|
||||
std::cout<<"\x1b[0;0H"; // Position the cursor (at 0, 0)
|
||||
if (haveInit) PAD_ScanPads();
|
||||
|
||||
VIDEO_ClearFrameBuffer(rmode, xfb, COLOR_BLACK);
|
||||
|
||||
printf("\x1b[4;0H");
|
||||
|
||||
for(int Chan = 0; Chan < 4; Chan++)
|
||||
printf("%i\tstatus: %x\t type:%x\n", Chan, SI_GetStatus(Chan), SI_GetType(Chan));
|
||||
|
||||
printf("SI Regs: (cc006000)\n");
|
||||
for (u32 i = 0; i < 16/*num SI regs*/; ++i)
|
||||
{
|
||||
std::cout << "Chan " << Chan << std::endl;
|
||||
std::cout << "Status is " << SI_GetStatus(Chan) << std::endl;
|
||||
std::cout << "Type is 0x" << std::setbase(16) << SI_GetType(Chan) << std::setbase(10) << std::endl << std::endl;
|
||||
printf("%08x ", SI_REG[i]);
|
||||
if ((i+1)%8==0) printf("\n");
|
||||
}
|
||||
|
||||
if (haveInit)
|
||||
printf("\nPAD_Init\n");
|
||||
|
||||
VIDEO_WaitVSync();
|
||||
|
||||
if (haveInit)
|
||||
{
|
||||
if (PAD_ButtonsDown(0) & PAD_BUTTON_START)
|
||||
{
|
||||
AppendSDLog();
|
||||
#ifdef HW_RVL
|
||||
fatUnmount("sd");
|
||||
__io_wiisd.shutdown();
|
||||
#endif
|
||||
reboot();
|
||||
}
|
||||
}
|
||||
|
||||
counter++;
|
||||
AppendSDLog();
|
||||
if (counter > 5 && !haveInit)
|
||||
{
|
||||
PAD_Init();
|
||||
haveInit = true;
|
||||
}
|
||||
else if (haveInit && !logWritten)
|
||||
{
|
||||
logWritten = true;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -39,9 +117,6 @@ void Initialise()
|
||||
// Initialise the video system
|
||||
VIDEO_Init();
|
||||
|
||||
// This function initialises the attached controllers
|
||||
PAD_Init();
|
||||
|
||||
// Obtain the preferred video mode from the system
|
||||
// This will correspond to the settings in the Wii menu
|
||||
rmode = VIDEO_GetPreferredMode(NULL);
|
||||
@ -67,4 +142,10 @@ void Initialise()
|
||||
// Wait for Video setup to complete
|
||||
VIDEO_WaitVSync();
|
||||
if(rmode->viTVMode&VI_NON_INTERLACE) VIDEO_WaitVSync();
|
||||
|
||||
#ifdef HW_RVL
|
||||
// Initialize FAT so we can write to SD.
|
||||
__io_wiisd.startup();
|
||||
fatMountSimple("sd", &__io_wiisd);
|
||||
#endif
|
||||
}
|
||||
|
Reference in New Issue
Block a user