mirror of
https://github.com/ekeeke/Genesis-Plus-GX.git
synced 2024-11-09 20:35:07 +01:00
fixed libDI support (thanks svpe)
This commit is contained in:
parent
18ae625179
commit
54fd830729
@ -21,6 +21,7 @@ current:
|
|||||||
|
|
||||||
[Wii only]
|
[Wii only]
|
||||||
- added lightgun & mouse support through Wiimote IR
|
- added lightgun & mouse support through Wiimote IR
|
||||||
|
- added DVD support thanks to libDI (no modchip required)
|
||||||
|
|
||||||
[NGC/Wii]
|
[NGC/Wii]
|
||||||
- added "Gun cursor" option to enable/disable gun position display
|
- added "Gun cursor" option to enable/disable gun position display
|
||||||
|
@ -24,14 +24,13 @@
|
|||||||
#ifndef HW_RVL
|
#ifndef HW_RVL
|
||||||
static u64 DvdMaxOffset = 0x57057C00; /* 1.4 GB max. */
|
static u64 DvdMaxOffset = 0x57057C00; /* 1.4 GB max. */
|
||||||
static vu32* const dvd = (u32*)0xCC006000; /* DVD I/O Address base */
|
static vu32* const dvd = (u32*)0xCC006000; /* DVD I/O Address base */
|
||||||
static u8 *inquiry=(unsigned char *)0x80000004;
|
static u8 *inquiry=(unsigned char *)0x80000004; /* pointer to drive ID */
|
||||||
|
|
||||||
#else
|
#else
|
||||||
static u64 DvdMaxOffset = 0x118244F00LL; /* 4.7 GB max. */
|
static u64 DvdMaxOffset = 0x118244F00LL; /* 4.7 GB max. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* 2k buffer for all DVD operations */
|
static u8 DVDreadbuffer[2048] ATTRIBUTE_ALIGN (32); /* data buffer for all DVD operations */
|
||||||
u8 DVDreadbuffer[2048] ATTRIBUTE_ALIGN (32);
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -67,17 +66,8 @@ u32 dvd_read (void *dst, u32 len, u64 offset)
|
|||||||
if (dvd[0] & 0x4) return 0;
|
if (dvd[0] & 0x4) return 0;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
int ret = DI_ReadDVD(buffer, len , (u32)(offset >> 2));
|
if (DI_ReadDVD(buffer, len >> 11, (u32)(offset >> 11))) return 0;
|
||||||
if (ret)
|
|
||||||
{
|
|
||||||
char msg[50];
|
|
||||||
u32 val;
|
|
||||||
DI_GetError(&val);
|
|
||||||
sprintf(msg, "DI Read Error: 0x%08X\n",val);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memcpy (dst, buffer, len);
|
memcpy (dst, buffer, len);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -191,7 +191,7 @@ static void FileSelected()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Add/move the file to the top of the history. */
|
/* Add/move the file to the top of the history. */
|
||||||
history_add_file(rootSDdir, filelist[selection].filename);
|
if (UseSDCARD) history_add_file(rootSDdir, filelist[selection].filename);
|
||||||
|
|
||||||
rootdir = filelist[selection].offset;
|
rootdir = filelist[selection].offset;
|
||||||
rootdirlength = filelist[selection].length;
|
rootdirlength = filelist[selection].length;
|
||||||
@ -408,7 +408,7 @@ static void FileSelector ()
|
|||||||
*
|
*
|
||||||
* Function to load a DVD directory and display to user.
|
* Function to load a DVD directory and display to user.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void OpenDVD ()
|
int OpenDVD ()
|
||||||
{
|
{
|
||||||
UseSDCARD = 0;
|
UseSDCARD = 0;
|
||||||
UseHistory = 0;
|
UseHistory = 0;
|
||||||
@ -421,6 +421,14 @@ void OpenDVD ()
|
|||||||
#ifndef HW_RVL
|
#ifndef HW_RVL
|
||||||
DVD_Mount();
|
DVD_Mount();
|
||||||
#else
|
#else
|
||||||
|
u32 val;
|
||||||
|
DI_GetCoverRegister(&val);
|
||||||
|
|
||||||
|
if(val & 0x1)
|
||||||
|
{
|
||||||
|
WaitPrompt("No Disc inserted !");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
DI_Mount();
|
DI_Mount();
|
||||||
while(DI_GetStatus() & DVD_INIT);
|
while(DI_GetStatus() & DVD_INIT);
|
||||||
if (!(DI_GetStatus() & DVD_READY))
|
if (!(DI_GetStatus() & DVD_READY))
|
||||||
@ -428,7 +436,7 @@ void OpenDVD ()
|
|||||||
char msg[50];
|
char msg[50];
|
||||||
sprintf(msg, "DI Status Error: 0x%08X\n",DI_GetStatus());
|
sprintf(msg, "DI Status Error: 0x%08X\n",DI_GetStatus());
|
||||||
WaitPrompt(msg);
|
WaitPrompt(msg);
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -436,7 +444,7 @@ void OpenDVD ()
|
|||||||
if (!getpvd())
|
if (!getpvd())
|
||||||
{
|
{
|
||||||
WaitPrompt ("Failed to mount DVD");
|
WaitPrompt ("Failed to mount DVD");
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -456,6 +464,8 @@ void OpenDVD ()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else FileSelector ();
|
else FileSelector ();
|
||||||
|
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
@ -511,7 +521,7 @@ int OpenSD ()
|
|||||||
*
|
*
|
||||||
* Function to load a recent file from SDCARD (Marty Disibio)
|
* Function to load a recent file from SDCARD (Marty Disibio)
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
void OpenHistory()
|
int OpenHistory()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -553,10 +563,11 @@ void OpenHistory()
|
|||||||
if(!maxfiles)
|
if(!maxfiles)
|
||||||
{
|
{
|
||||||
WaitPrompt ("No recent files");
|
WaitPrompt ("No recent files");
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
FileSelector();
|
FileSelector();
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ int rootdirlength = 0;
|
|||||||
|
|
||||||
/** Global file entry table **/
|
/** Global file entry table **/
|
||||||
FILEENTRIES filelist[MAXFILES];
|
FILEENTRIES filelist[MAXFILES];
|
||||||
static char dvdbuffer[2048];
|
static char dvdbuffer[2048] ATTRIBUTE_ALIGN (32);
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Primary Volume Descriptor
|
* Primary Volume Descriptor
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#ifdef HW_RVL
|
#ifdef HW_RVL
|
||||||
#include <wiiuse/wpad.h>
|
#include <wiiuse/wpad.h>
|
||||||
|
#include <di/di.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
@ -877,11 +878,12 @@ void loadmenu ()
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
int quit = 0;
|
int quit = 0;
|
||||||
int count = 3;
|
int count = 4;
|
||||||
char item[3][20] = {
|
char item[4][20] = {
|
||||||
{"Load Recent"},
|
{"Load Recent"},
|
||||||
{"Load from SDCARD"},
|
{"Load from SDCARD"},
|
||||||
{"Load from DVD"}
|
{"Load from DVD"},
|
||||||
|
{"Stop DVD Motor"}
|
||||||
};
|
};
|
||||||
|
|
||||||
menu = load_menu;
|
menu = load_menu;
|
||||||
@ -897,18 +899,19 @@ void loadmenu ()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 0: /*** Load Recent ***/
|
case 0: /*** Load Recent ***/
|
||||||
OpenHistory();
|
quit = OpenHistory();
|
||||||
quit = 1;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: /*** Load from SCDARD ***/
|
case 1: /*** Load from SCDARD ***/
|
||||||
OpenSD();
|
quit = OpenSD();
|
||||||
quit = 1;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2: /*** Load from DVD ***/
|
case 2: /*** Load from DVD ***/
|
||||||
OpenDVD();
|
quit = OpenDVD();
|
||||||
quit = 1;
|
break;
|
||||||
|
|
||||||
|
case 3: /*** Stop DVD Disc ***/
|
||||||
|
dvd_motor_off();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1048,13 +1051,8 @@ void MainMenu ()
|
|||||||
int quit = 0;
|
int quit = 0;
|
||||||
uint32 crccheck;
|
uint32 crccheck;
|
||||||
|
|
||||||
#ifdef HW_RVL
|
|
||||||
int count = 8;
|
int count = 8;
|
||||||
char items[8][20] =
|
char items[8][20] =
|
||||||
#else
|
|
||||||
int count = 9;
|
|
||||||
char items[9][20] =
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
{"Play Game"},
|
{"Play Game"},
|
||||||
{"Game Infos"},
|
{"Game Infos"},
|
||||||
@ -1062,14 +1060,8 @@ void MainMenu ()
|
|||||||
{"Load New Game"},
|
{"Load New Game"},
|
||||||
{"File Management"},
|
{"File Management"},
|
||||||
{"Emulator Options"},
|
{"Emulator Options"},
|
||||||
#ifdef HW_RVL
|
|
||||||
{"Return to Loader"},
|
{"Return to Loader"},
|
||||||
{"System Menu"}
|
|
||||||
#else
|
|
||||||
{"Stop DVD Motor"},
|
|
||||||
{"SD/PSO Reload"},
|
|
||||||
{"System Reboot"}
|
{"System Reboot"}
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Switch to menu default rendering mode (60hz or 50hz, but always 480 lines) */
|
/* Switch to menu default rendering mode (60hz or 50hz, but always 480 lines) */
|
||||||
@ -1123,12 +1115,14 @@ void MainMenu ()
|
|||||||
optionmenu ();
|
optionmenu ();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef HW_RVL
|
case 6: /*** SD/PSO/TP Reload ***/
|
||||||
case 6: /*** TP Reload ***/
|
|
||||||
memfile_autosave();
|
memfile_autosave();
|
||||||
VIDEO_ClearFrameBuffer(vmode, xfb[whichfb], COLOR_BLACK);
|
VIDEO_ClearFrameBuffer(vmode, xfb[whichfb], COLOR_BLACK);
|
||||||
VIDEO_Flush();
|
VIDEO_Flush();
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
|
#ifdef HW_RVL
|
||||||
|
DI_Close();
|
||||||
|
#endif
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1137,27 +1131,13 @@ void MainMenu ()
|
|||||||
VIDEO_ClearFrameBuffer(vmode, xfb[whichfb], COLOR_BLACK);
|
VIDEO_ClearFrameBuffer(vmode, xfb[whichfb], COLOR_BLACK);
|
||||||
VIDEO_Flush();
|
VIDEO_Flush();
|
||||||
VIDEO_WaitVSync();
|
VIDEO_WaitVSync();
|
||||||
|
#ifdef HW_RVL
|
||||||
|
DI_Close();
|
||||||
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
SYS_ResetSystem(SYS_RETURNTOMENU, 0, 0);
|
||||||
break;
|
|
||||||
#else
|
#else
|
||||||
case 6: /*** Stop DVD Motor ***/
|
|
||||||
ShowAction("Stopping DVD Motor ...");
|
|
||||||
dvd_motor_off();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 7: /*** SD/PSO Reload ***/
|
|
||||||
memfile_autosave();
|
|
||||||
VIDEO_ClearFrameBuffer(vmode, xfb[whichfb], COLOR_BLACK);
|
|
||||||
VIDEO_Flush();
|
|
||||||
VIDEO_WaitVSync();
|
|
||||||
exit(0);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 8: /*** Reboot Gamecube ***/
|
|
||||||
memfile_autosave();
|
|
||||||
SYS_ResetSystem(SYS_HOTRESET,0,0);
|
SYS_ResetSystem(SYS_HOTRESET,0,0);
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,9 +34,9 @@ extern void MainMenu();
|
|||||||
extern void set_region();
|
extern void set_region();
|
||||||
extern int ManageSRAM(u8 direction, u8 device);
|
extern int ManageSRAM(u8 direction, u8 device);
|
||||||
extern int ManageState(u8 direction, u8 device);
|
extern int ManageState(u8 direction, u8 device);
|
||||||
extern void OpenDVD();
|
extern int OpenDVD();
|
||||||
extern int OpenSD();
|
extern int OpenSD();
|
||||||
extern void OpenHistory();
|
extern int OpenHistory();
|
||||||
extern void memfile_autosave();
|
extern void memfile_autosave();
|
||||||
extern void memfile_autoload();
|
extern void memfile_autoload();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user