mirror of
https://github.com/extremscorner/not64.git
synced 2024-05-15 02:29:42 -04:00
Added GC Loader 2.0.0 write support.
Added M.2 Loader support. Added directory structure creation. Added USB storage device name compatibility. Fixed Wii Remote extension controller hotplug. Fixed LoadButtonSlot argument. Fixed RSP DMA memory alignment. Fixed viewport flipping. Other minor fixes.
This commit is contained in:
parent
6f4fbb76f3
commit
d7ca5e913f
|
@ -52,13 +52,14 @@ const DISC_INTERFACE* cardb = &__io_gcsdb;
|
|||
const DISC_INTERFACE* cardc = &__io_gcsd2;
|
||||
const DISC_INTERFACE* ideexia = &__io_ataa;
|
||||
const DISC_INTERFACE* ideexib = &__io_atab;
|
||||
const DISC_INTERFACE* ideexic = &__io_ata1;
|
||||
|
||||
// Threaded insertion/removal detection
|
||||
#define THREAD_SLEEP 100
|
||||
#define CARD_A 1
|
||||
#define CARD_B 2
|
||||
#define CARD_C 3
|
||||
#define GCLOADER 3
|
||||
#define GCLOADER 4
|
||||
#define FRONTSD 3
|
||||
#define USB 3
|
||||
static lwp_t removalThread = LWP_THREAD_NULL;
|
||||
|
@ -254,105 +255,119 @@ int fileBrowser_libfat_writeFile(fileBrowser_file* file, void* buffer, unsigned
|
|||
- returns 1 on ok
|
||||
*/
|
||||
int fileBrowser_libfat_init(fileBrowser_file* f){
|
||||
|
||||
|
||||
int res = 0;
|
||||
|
||||
if(!rThreadCreated) InitRemovalThread();
|
||||
|
||||
if(!rThreadCreated) InitRemovalThread();
|
||||
#ifdef HW_RVL
|
||||
if(f->name[0] == 's') { //SD
|
||||
if(!sdMounted) { //if there's nothing currently mounted
|
||||
if(!strncmp(f->name, "sd", 2)) { //SD
|
||||
if(!sdMounted) { //if there's nothing currently mounted
|
||||
pauseRemovalThread();
|
||||
if(sdNeedsUnmount==FRONTSD) {
|
||||
fatUnmount("sd:");
|
||||
fatUnmount(f->name);
|
||||
frontsd->shutdown();
|
||||
sdNeedsUnmount = 0;
|
||||
}
|
||||
if(fatMountSimple ("sd", frontsd)) {
|
||||
sdMounted = FRONTSD;
|
||||
res = 1;
|
||||
}
|
||||
else if(fatMountSimple ("sd", cardb)) {
|
||||
sdMounted = CARD_B;
|
||||
res = 1;
|
||||
}
|
||||
else if(fatMountSimple ("sd", carda)) {
|
||||
sdMounted = CARD_A;
|
||||
res = 1;
|
||||
}
|
||||
continueRemovalThread();
|
||||
return res;
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
else if(f->name[0] == 'f') {
|
||||
if(!fatMounted) {
|
||||
pauseRemovalThread();
|
||||
if(fatNeedsUnmount==USB) {
|
||||
fatUnmount("fat:");
|
||||
usb->shutdown();
|
||||
fatNeedsUnmount=0;
|
||||
}
|
||||
usleep(devsleep);
|
||||
if(fatMountSimple ("fat", usb)) {
|
||||
fatMounted = USB;
|
||||
if(fatMountSimple("sd", frontsd)) {
|
||||
sdMounted = FRONTSD;
|
||||
res = 1;
|
||||
}
|
||||
else if(fatMountSimple ("fat", ideexib)) {
|
||||
fatMounted = CARD_B;
|
||||
res = 1;
|
||||
}
|
||||
else if(fatMountSimple ("fat", ideexia)) {
|
||||
fatMounted = CARD_A;
|
||||
res = 1;
|
||||
else if(fatMountSimple("sd", cardb)) {
|
||||
sdMounted = CARD_B;
|
||||
res = 1;
|
||||
}
|
||||
else if(fatMountSimple("sd", carda)) {
|
||||
sdMounted = CARD_A;
|
||||
res = 1;
|
||||
}
|
||||
continueRemovalThread();
|
||||
return res;
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
res = 1;
|
||||
if(res)
|
||||
mkdir("sd:/not64", 0755);
|
||||
}
|
||||
else if(!strncmp(f->name, "fat", 3)) {
|
||||
if(!fatMounted) {
|
||||
pauseRemovalThread();
|
||||
if(fatNeedsUnmount==USB) {
|
||||
fatUnmount(f->name);
|
||||
usb->shutdown();
|
||||
fatNeedsUnmount=0;
|
||||
}
|
||||
usleep(devsleep);
|
||||
if(fatMountSimple("fat", usb)) {
|
||||
fatMounted = USB;
|
||||
res = 1;
|
||||
}
|
||||
else if(fatMountSimple("fat", ideexib)) {
|
||||
fatMounted = CARD_B;
|
||||
res = 1;
|
||||
}
|
||||
else if(fatMountSimple("fat", ideexia)) {
|
||||
fatMounted = CARD_A;
|
||||
res = 1;
|
||||
}
|
||||
continueRemovalThread();
|
||||
}
|
||||
else
|
||||
res = 1;
|
||||
if(res)
|
||||
mkdir("fat:/not64", 0755);
|
||||
}
|
||||
#else
|
||||
if(f->name[0] == 's') {
|
||||
if(!strncmp(f->name, "sd", 2)) {
|
||||
if(!sdMounted) {
|
||||
if(fatMountSimple ("sd", cardc)) {
|
||||
sdMounted = CARD_C;
|
||||
res = 1;
|
||||
}
|
||||
else if(fatMountSimple ("sd", cardb)) {
|
||||
sdMounted = CARD_B;
|
||||
res = 1;
|
||||
}
|
||||
else if(fatMountSimple ("sd", carda)) {
|
||||
sdMounted = CARD_A;
|
||||
res = 1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
else if(f->name[0] == 'f') {
|
||||
if(!fatMounted) {
|
||||
if(fatMountSimple ("fat", gcloader)) {
|
||||
fatMounted = GCLOADER;
|
||||
res = 1;
|
||||
}
|
||||
else if(fatMountSimple ("fat", ideexib)) {
|
||||
fatMounted = CARD_B;
|
||||
res = 1;
|
||||
if(fatMountSimple("sd", cardc)) {
|
||||
sdMounted = CARD_C;
|
||||
res = 1;
|
||||
}
|
||||
else if(fatMountSimple ("fat", ideexia)) {
|
||||
fatMounted = CARD_A;
|
||||
res = 1;
|
||||
else if(fatMountSimple("sd", cardb)) {
|
||||
sdMounted = CARD_B;
|
||||
res = 1;
|
||||
}
|
||||
else if(fatMountSimple("sd", carda)) {
|
||||
sdMounted = CARD_A;
|
||||
res = 1;
|
||||
}
|
||||
else if(fatMounted != GCLOADER && fatMountSimple("sd", gcloader)) {
|
||||
sdMounted = GCLOADER;
|
||||
res = 1;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
res = 1;
|
||||
if(res)
|
||||
mkdir("sd:/not64", 0755);
|
||||
}
|
||||
else if(!strncmp(f->name, "fat", 3)) {
|
||||
if(!fatMounted) {
|
||||
if(sdMounted != GCLOADER && fatMountSimple("fat", gcloader)) {
|
||||
fatMounted = GCLOADER;
|
||||
res = 1;
|
||||
}
|
||||
else if(fatMountSimple("fat", ideexic)) {
|
||||
fatMounted = CARD_C;
|
||||
res = 1;
|
||||
}
|
||||
else if(fatMountSimple("fat", ideexib)) {
|
||||
fatMounted = CARD_B;
|
||||
res = 1;
|
||||
}
|
||||
else if(fatMountSimple("fat", ideexia)) {
|
||||
fatMounted = CARD_A;
|
||||
res = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
res = 1;
|
||||
if(res)
|
||||
mkdir("fat:/not64", 0755);
|
||||
}
|
||||
#endif
|
||||
return res;
|
||||
if(res)
|
||||
mkdir(f->name, 0755);
|
||||
return res;
|
||||
}
|
||||
|
||||
int fileBrowser_libfat_deinit(fileBrowser_file* f){
|
||||
|
|
|
@ -193,22 +193,33 @@ EXPORT void CALL GetDllInfo ( PLUGIN_INFO * PluginInfo )
|
|||
extern int stop;
|
||||
EXPORT void CALL GetKeys(int Control, BUTTONS * Keys )
|
||||
{
|
||||
#if defined(WII) && !defined(NO_BT)
|
||||
//Need to switch between Classic and WiimoteNunchuck if user swapped extensions
|
||||
if (padType[virtualControllers[Control].number] == PADTYPE_WII)
|
||||
{
|
||||
if (virtualControllers[Control].control == &controller_Classic &&
|
||||
!controller_Classic.available[virtualControllers[Control].number] &&
|
||||
controller_WiimoteNunchuk.available[virtualControllers[Control].number])
|
||||
assign_controller(Control, &controller_WiimoteNunchuk, virtualControllers[Control].number);
|
||||
else if (virtualControllers[Control].control == &controller_WiimoteNunchuk &&
|
||||
!controller_WiimoteNunchuk.available[virtualControllers[Control].number] &&
|
||||
controller_Classic.available[virtualControllers[Control].number])
|
||||
assign_controller(Control, &controller_Classic, virtualControllers[Control].number);
|
||||
}
|
||||
#endif
|
||||
if(DO_CONTROL(Control, GetKeys, Keys, virtualControllers[Control].config))
|
||||
stop = 1;
|
||||
#if defined(WII) && !defined(NO_BT)
|
||||
// Need to switch between Classic and WiimoteNunchuck if user swapped extensions
|
||||
if(!virtualControllers[Control].control->available[virtualControllers[Control].number]){
|
||||
switch(padType[Control]){
|
||||
case PADTYPE_WII:
|
||||
if(controller_ExtenmoteGC.available[virtualControllers[Control].number])
|
||||
assign_controller(Control, &controller_ExtenmoteGC, virtualControllers[Control].number);
|
||||
else if(controller_ExtenmoteN64.available[virtualControllers[Control].number])
|
||||
assign_controller(Control, &controller_ExtenmoteN64, virtualControllers[Control].number);
|
||||
else if(controller_ExtenmoteSNES.available[virtualControllers[Control].number])
|
||||
assign_controller(Control, &controller_ExtenmoteSNES, virtualControllers[Control].number);
|
||||
else if(controller_ExtenmoteNES.available[virtualControllers[Control].number])
|
||||
assign_controller(Control, &controller_ExtenmoteNES, virtualControllers[Control].number);
|
||||
else if(controller_WiiUPro.available[virtualControllers[Control].number])
|
||||
assign_controller(Control, &controller_WiiUPro, virtualControllers[Control].number);
|
||||
else if(controller_Classic.available[virtualControllers[Control].number])
|
||||
assign_controller(Control, &controller_Classic, virtualControllers[Control].number);
|
||||
else if(controller_WiimoteNunchuk.available[virtualControllers[Control].number])
|
||||
assign_controller(Control, &controller_WiimoteNunchuk, virtualControllers[Control].number);
|
||||
else if(controller_Wiimote.available[virtualControllers[Control].number])
|
||||
assign_controller(Control, &controller_Wiimote, virtualControllers[Control].number);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/******************************************************************
|
||||
|
|
|
@ -121,7 +121,7 @@ void dma_pi_read()
|
|||
sramWritten = TRUE;
|
||||
|
||||
for (i=0; i<(pi_register.pi_rd_len_reg & 0xFFFFFE)+2; i++)
|
||||
sram[((pi_register.pi_cart_addr_reg-0x08000000)+i)^S8]=
|
||||
sram[(((pi_register.pi_cart_addr_reg-0x08000000)&0xFFFE)+i)^S8]=
|
||||
((unsigned char*)rdram)[(pi_register.pi_dram_addr_reg+i)^S8];
|
||||
|
||||
use_flashram = -1;
|
||||
|
@ -300,8 +300,8 @@ void dma_sp_write()
|
|||
unsigned int count = ((l >> 12) & 0xff) + 1;
|
||||
unsigned int skip = ((l >> 20) & 0xfff);
|
||||
|
||||
unsigned char *spmem = SP_DMEMb + (sp_register.sp_mem_addr_reg & 0x1fff);
|
||||
unsigned char *dram = rdramb + (sp_register.sp_dram_addr_reg & 0xffffff);
|
||||
unsigned char *spmem = SP_DMEMb + (sp_register.sp_mem_addr_reg & 0x1ff8);
|
||||
unsigned char *dram = rdramb + (sp_register.sp_dram_addr_reg & 0xfffff8);
|
||||
|
||||
for(i=0; i<count; i++) {
|
||||
spmem = memcpy(spmem, dram, length);
|
||||
|
@ -320,8 +320,8 @@ void dma_sp_read()
|
|||
unsigned int count = ((l >> 12) & 0xff) + 1;
|
||||
unsigned int skip = ((l >> 20) & 0xfff);
|
||||
|
||||
unsigned char *spmem = SP_DMEMb + (sp_register.sp_mem_addr_reg & 0x1fff);
|
||||
unsigned char *dram = rdramb + (sp_register.sp_dram_addr_reg & 0xffffff);
|
||||
unsigned char *spmem = SP_DMEMb + (sp_register.sp_mem_addr_reg & 0x1ff8);
|
||||
unsigned char *dram = rdramb + (sp_register.sp_dram_addr_reg & 0xfffff8);
|
||||
|
||||
for(i=0; i<count; i++) {
|
||||
dram = memcpy(dram, spmem, length);
|
||||
|
|
|
@ -809,10 +809,10 @@ void OGL_UpdateStates()
|
|||
#else // !__GX__
|
||||
if ((gDP.changed & CHANGED_SCISSOR) || (gSP.changed & CHANGED_VIEWPORT))
|
||||
{
|
||||
float ulx = max(OGL.GXorigX + max(gDP.scissor.ulx,gSP.viewport.x) * OGL.GXscaleX, 0);
|
||||
float uly = max(OGL.GXorigY + max(gDP.scissor.uly,gSP.viewport.y) * OGL.GXscaleY, 0);
|
||||
float lrx = max(OGL.GXorigX + min(min(gDP.scissor.lrx,gSP.viewport.x + gSP.viewport.width) * OGL.GXscaleX,OGL.GXwidth), 0);
|
||||
float lry = max(OGL.GXorigY + min(min(gDP.scissor.lry,gSP.viewport.y + gSP.viewport.height) * OGL.GXscaleY,OGL.GXheight), 0);
|
||||
float ulx = max(OGL.GXorigX + gDP.scissor.ulx * OGL.GXscaleX, 0);
|
||||
float uly = max(OGL.GXorigY + gDP.scissor.uly * OGL.GXscaleY, 0);
|
||||
float lrx = max(OGL.GXorigX + min(gDP.scissor.lrx * OGL.GXscaleX,OGL.GXwidth), 0);
|
||||
float lry = max(OGL.GXorigY + min(gDP.scissor.lry * OGL.GXscaleY,OGL.GXheight), 0);
|
||||
GX_SetScissor((u32) ulx,(u32) uly,(u32) (lrx - ulx),(u32) (lry - uly));
|
||||
}
|
||||
#endif // __GX__
|
||||
|
|
|
@ -393,8 +393,8 @@ void gSPViewport( u32 v )
|
|||
|
||||
gSP.viewport.x = gSP.viewport.vtrans[0] - gSP.viewport.vscale[0];
|
||||
gSP.viewport.y = gSP.viewport.vtrans[1] - gSP.viewport.vscale[1];
|
||||
gSP.viewport.width = fabs(gSP.viewport.vscale[0]) * 2;
|
||||
gSP.viewport.height = fabs(gSP.viewport.vscale[1]) * 2;
|
||||
gSP.viewport.width = gSP.viewport.vscale[0] * 2;
|
||||
gSP.viewport.height = gSP.viewport.vscale[1] * 2;
|
||||
gSP.viewport.nearz = gSP.viewport.vtrans[2] - gSP.viewport.vscale[2];
|
||||
gSP.viewport.farz = gSP.viewport.vtrans[2] + gSP.viewport.vscale[2];
|
||||
|
||||
|
|
132
main/ata.c
132
main/ata.c
|
@ -19,7 +19,7 @@
|
|||
#define IDE_EXI_V2 1
|
||||
|
||||
u16 buffer[256] ATTRIBUTE_ALIGN (32);
|
||||
static int __ata_init[2] = {0,0};
|
||||
static int __ata_init[3] = {0,0,0};
|
||||
static int _ideexi_version = IDE_EXI_V1;
|
||||
|
||||
// Drive information struct
|
||||
|
@ -28,10 +28,15 @@ typeDriveInfo ataDriveInfo;
|
|||
// Returns 8 bits from the ATA Status register
|
||||
static inline u8 ataReadStatusReg(int chn)
|
||||
{
|
||||
int dev = EXI_DEVICE_0;
|
||||
if(chn == EXI_CHANNEL_2) {
|
||||
chn = EXI_CHANNEL_0;
|
||||
dev = EXI_DEVICE_2;
|
||||
}
|
||||
// read ATA_REG_CMDSTATUS1 | 0x00 (dummy)
|
||||
u16 dat = 0x1700;
|
||||
EXI_Lock(chn, 0, NULL);
|
||||
EXI_Select(chn,0,EXI_SPEED32MHZ);
|
||||
EXI_Lock(chn, dev, NULL);
|
||||
EXI_Select(chn,dev,EXI_SPEED32MHZ);
|
||||
EXI_ImmEx(chn,&dat,2,EXI_WRITE);
|
||||
EXI_ImmEx(chn,&dat,1,EXI_READ);
|
||||
EXI_Deselect(chn);
|
||||
|
@ -42,10 +47,15 @@ static inline u8 ataReadStatusReg(int chn)
|
|||
// Returns 8 bits from the ATA Error register
|
||||
static inline u8 ataReadErrorReg(int chn)
|
||||
{
|
||||
int dev = EXI_DEVICE_0;
|
||||
if(chn == EXI_CHANNEL_2) {
|
||||
chn = EXI_CHANNEL_0;
|
||||
dev = EXI_DEVICE_2;
|
||||
}
|
||||
// read ATA_REG_ERROR | 0x00 (dummy)
|
||||
u16 dat = 0x1100;
|
||||
EXI_Lock(chn, 0, NULL);
|
||||
EXI_Select(chn,0,EXI_SPEED32MHZ);
|
||||
EXI_Lock(chn, dev, NULL);
|
||||
EXI_Select(chn,dev,EXI_SPEED32MHZ);
|
||||
EXI_ImmEx(chn,&dat,2,EXI_WRITE);
|
||||
EXI_ImmEx(chn,&dat,1,EXI_READ);
|
||||
EXI_Deselect(chn);
|
||||
|
@ -56,9 +66,14 @@ static inline u8 ataReadErrorReg(int chn)
|
|||
// Writes 8 bits of data out to the specified ATA Register
|
||||
static inline void ataWriteByte(int chn, u8 addr, u8 data)
|
||||
{
|
||||
int dev = EXI_DEVICE_0;
|
||||
if(chn == EXI_CHANNEL_2) {
|
||||
chn = EXI_CHANNEL_0;
|
||||
dev = EXI_DEVICE_2;
|
||||
}
|
||||
u32 dat = 0x80000000 | (addr << 24) | (data<<16);
|
||||
EXI_Lock(chn, 0, NULL);
|
||||
EXI_Select(chn,0,EXI_SPEED32MHZ);
|
||||
EXI_Lock(chn, dev, NULL);
|
||||
EXI_Select(chn,dev,EXI_SPEED32MHZ);
|
||||
EXI_ImmEx(chn,&dat,3,EXI_WRITE);
|
||||
EXI_Deselect(chn);
|
||||
EXI_Unlock(chn);
|
||||
|
@ -67,10 +82,15 @@ static inline void ataWriteByte(int chn, u8 addr, u8 data)
|
|||
// Writes 16 bits to the ATA Data register
|
||||
static inline void ataWriteu16(int chn, u16 data)
|
||||
{
|
||||
int dev = EXI_DEVICE_0;
|
||||
if(chn == EXI_CHANNEL_2) {
|
||||
chn = EXI_CHANNEL_0;
|
||||
dev = EXI_DEVICE_2;
|
||||
}
|
||||
// write 16 bit to ATA_REG_DATA | data LSB | data MSB | 0x00 (dummy)
|
||||
u32 dat = 0xD0000000 | (((data>>8) & 0xff)<<16) | ((data & 0xff)<<8);
|
||||
EXI_Lock(chn, 0, NULL);
|
||||
EXI_Select(chn,0,EXI_SPEED32MHZ);
|
||||
EXI_Lock(chn, dev, NULL);
|
||||
EXI_Select(chn,dev,EXI_SPEED32MHZ);
|
||||
EXI_ImmEx(chn,&dat,4,EXI_WRITE);
|
||||
EXI_Deselect(chn);
|
||||
EXI_Unlock(chn);
|
||||
|
@ -80,10 +100,15 @@ static inline void ataWriteu16(int chn, u16 data)
|
|||
// Returns 16 bits from the ATA Data register
|
||||
static inline u16 ataReadu16(int chn)
|
||||
{
|
||||
int dev = EXI_DEVICE_0;
|
||||
if(chn == EXI_CHANNEL_2) {
|
||||
chn = EXI_CHANNEL_0;
|
||||
dev = EXI_DEVICE_2;
|
||||
}
|
||||
// read 16 bit from ATA_REG_DATA | 0x00 (dummy)
|
||||
u16 dat = 0x5000;
|
||||
EXI_Lock(chn, 0, NULL);
|
||||
EXI_Select(chn,0,EXI_SPEED32MHZ);
|
||||
EXI_Lock(chn, dev, NULL);
|
||||
EXI_Select(chn,dev,EXI_SPEED32MHZ);
|
||||
EXI_ImmEx(chn,&dat,2,EXI_WRITE);
|
||||
EXI_ImmEx(chn,&dat,2,EXI_READ); // read LSB & MSB
|
||||
EXI_Deselect(chn);
|
||||
|
@ -95,11 +120,16 @@ static inline u16 ataReadu16(int chn)
|
|||
// Reads 512 bytes
|
||||
static inline void ata_read_buffer(int chn, u32 *dst)
|
||||
{
|
||||
int dev = EXI_DEVICE_0;
|
||||
if(chn == EXI_CHANNEL_2) {
|
||||
chn = EXI_CHANNEL_0;
|
||||
dev = EXI_DEVICE_2;
|
||||
}
|
||||
u16 dwords = 128; // 128 * 4 = 512 bytes
|
||||
// (31:29) 011b | (28:24) 10000b | (23:16) <num_words_LSB> | (15:8) <num_words_MSB> | (7:0) 00h (4 bytes)
|
||||
u32 dat = 0x70000000 | ((dwords&0xff) << 16) | (((dwords>>8)&0xff) << 8);
|
||||
EXI_Lock(chn, 0, NULL);
|
||||
EXI_Select(chn,0,EXI_SPEED32MHZ);
|
||||
EXI_Lock(chn, dev, NULL);
|
||||
EXI_Select(chn,dev,EXI_SPEED32MHZ);
|
||||
EXI_ImmEx(chn,&dat,4,EXI_WRITE);
|
||||
if(_ideexi_version == IDE_EXI_V1) {
|
||||
// IDE_EXI_V1, select / deselect for every 4 bytes
|
||||
|
@ -108,15 +138,15 @@ static inline void ata_read_buffer(int chn, u32 *dst)
|
|||
u32 i = 0;
|
||||
u32 *ptr = dst;
|
||||
for(i = 0; i < dwords; i++) {
|
||||
EXI_Lock(chn, 0, NULL);
|
||||
EXI_Select(chn,0,EXI_SPEED32MHZ);
|
||||
EXI_Lock(chn, dev, NULL);
|
||||
EXI_Select(chn,dev,EXI_SPEED32MHZ);
|
||||
EXI_ImmEx(chn,ptr,4,EXI_READ);
|
||||
ptr++;
|
||||
EXI_Deselect(chn);
|
||||
EXI_Unlock(chn);
|
||||
}
|
||||
EXI_Lock(chn, 0, NULL);
|
||||
EXI_Select(chn,0,EXI_SPEED32MHZ);
|
||||
EXI_Lock(chn, dev, NULL);
|
||||
EXI_Select(chn,dev,EXI_SPEED32MHZ);
|
||||
EXI_ImmEx(chn,&dat,4,EXI_READ);
|
||||
EXI_Deselect(chn);
|
||||
EXI_Unlock(chn);
|
||||
|
@ -131,11 +161,16 @@ static inline void ata_read_buffer(int chn, u32 *dst)
|
|||
|
||||
static inline void ata_write_buffer(int chn, u32 *src)
|
||||
{
|
||||
int dev = EXI_DEVICE_0;
|
||||
if(chn == EXI_CHANNEL_2) {
|
||||
chn = EXI_CHANNEL_0;
|
||||
dev = EXI_DEVICE_2;
|
||||
}
|
||||
u16 dwords = 128; // 128 * 4 = 512 bytes
|
||||
// (23:21) 111b | (20:16) 10000b | (15:8) <num_words_LSB> | (7:0) <num_words_MSB> (3 bytes)
|
||||
u32 dat = 0xF0000000 | ((dwords&0xff) << 16) | (((dwords>>8)&0xff) << 8);
|
||||
EXI_Lock(chn, 0, NULL);
|
||||
EXI_Select(chn,0,EXI_SPEED32MHZ);
|
||||
EXI_Lock(chn, dev, NULL);
|
||||
EXI_Select(chn,dev,EXI_SPEED32MHZ);
|
||||
EXI_ImmEx(chn,&dat,3,EXI_WRITE);
|
||||
EXI_ImmEx(chn, src,512,EXI_WRITE);
|
||||
dat = 0;
|
||||
|
@ -145,9 +180,13 @@ static inline void ata_write_buffer(int chn, u32 *src)
|
|||
}
|
||||
|
||||
int _ideExiVersion(int chn) {
|
||||
int dev = EXI_DEVICE_0;
|
||||
if(chn == EXI_CHANNEL_2) {
|
||||
chn = EXI_CHANNEL_0;
|
||||
dev = EXI_DEVICE_2;
|
||||
}
|
||||
u32 cid = 0;
|
||||
EXI_GetID(chn,EXI_DEVICE_0,&cid);
|
||||
|
||||
EXI_GetID(chn,dev,&cid);
|
||||
if(cid==0x49444532) {
|
||||
return IDE_EXI_V2;
|
||||
}
|
||||
|
@ -167,6 +206,9 @@ u32 _ataDriveIdentify(int chn) {
|
|||
|
||||
// Get the ID to see if it's a V2
|
||||
_ideexi_version = _ideExiVersion(chn);
|
||||
if(_ideexi_version == IDE_EXI_V1 && chn == EXI_CHANNEL_2) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Select the device
|
||||
ataWriteByte(chn, ATA_REG_DEVICE, 0);
|
||||
|
@ -467,12 +509,12 @@ static bool __ataa_isInserted(void)
|
|||
return ataIsInserted(0);
|
||||
}
|
||||
|
||||
static bool __ataa_readSectors(u32 sector, u32 numSectors, void *buffer)
|
||||
static bool __ataa_readSectors(sec_t sector, sec_t numSectors, void *buffer)
|
||||
{
|
||||
return !ataReadSectors(0, (u64)sector, numSectors, buffer);
|
||||
}
|
||||
|
||||
static bool __ataa_writeSectors(u32 sector, u32 numSectors, void *buffer)
|
||||
static bool __ataa_writeSectors(sec_t sector, sec_t numSectors, void *buffer)
|
||||
{
|
||||
return !ataWriteSectors(0, (u64)sector, numSectors, buffer);
|
||||
}
|
||||
|
@ -497,12 +539,12 @@ static bool __atab_isInserted(void)
|
|||
return ataIsInserted(1);
|
||||
}
|
||||
|
||||
static bool __atab_readSectors(u32 sector, u32 numSectors, void *buffer)
|
||||
static bool __atab_readSectors(sec_t sector, sec_t numSectors, void *buffer)
|
||||
{
|
||||
return !ataReadSectors(1, (u64)sector, numSectors, buffer);
|
||||
}
|
||||
|
||||
static bool __atab_writeSectors(u32 sector, u32 numSectors, void *buffer)
|
||||
static bool __atab_writeSectors(sec_t sector, sec_t numSectors, void *buffer)
|
||||
{
|
||||
return !ataWriteSectors(1, (u64)sector, numSectors, buffer);
|
||||
}
|
||||
|
@ -517,6 +559,36 @@ static bool __atab_shutdown(void)
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool __ata1_startup(void)
|
||||
{
|
||||
return ataIsInserted(2);
|
||||
}
|
||||
|
||||
static bool __ata1_isInserted(void)
|
||||
{
|
||||
return ataIsInserted(2);
|
||||
}
|
||||
|
||||
static bool __ata1_readSectors(sec_t sector, sec_t numSectors, void *buffer)
|
||||
{
|
||||
return !ataReadSectors(2, (u64)sector, numSectors, buffer);
|
||||
}
|
||||
|
||||
static bool __ata1_writeSectors(sec_t sector, sec_t numSectors, void *buffer)
|
||||
{
|
||||
return !ataWriteSectors(2, (u64)sector, numSectors, buffer);
|
||||
}
|
||||
|
||||
static bool __ata1_clearStatus(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool __ata1_shutdown(void)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
const DISC_INTERFACE __io_ataa = {
|
||||
DEVICE_TYPE_GC_ATA,
|
||||
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_GAMECUBE_SLOTA,
|
||||
|
@ -537,3 +609,13 @@ const DISC_INTERFACE __io_atab = {
|
|||
(FN_MEDIUM_CLEARSTATUS)&__atab_clearStatus,
|
||||
(FN_MEDIUM_SHUTDOWN)&__atab_shutdown
|
||||
} ;
|
||||
const DISC_INTERFACE __io_ata1 = {
|
||||
DEVICE_TYPE_GC_ATA,
|
||||
FEATURE_MEDIUM_CANREAD | FEATURE_MEDIUM_CANWRITE | FEATURE_GAMECUBE_PORT1,
|
||||
(FN_MEDIUM_STARTUP)&__ata1_startup,
|
||||
(FN_MEDIUM_ISINSERTED)&__ata1_isInserted,
|
||||
(FN_MEDIUM_READSECTORS)&__ata1_readSectors,
|
||||
(FN_MEDIUM_WRITESECTORS)&__ata1_writeSectors,
|
||||
(FN_MEDIUM_CLEARSTATUS)&__ata1_clearStatus,
|
||||
(FN_MEDIUM_SHUTDOWN)&__ata1_shutdown
|
||||
} ;
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
extern const DISC_INTERFACE __io_ataa;
|
||||
extern const DISC_INTERFACE __io_atab;
|
||||
extern const DISC_INTERFACE __io_ata1;
|
||||
|
||||
// ATA status register bits
|
||||
#define ATA_SR_BSY 0x80
|
||||
|
@ -81,14 +82,14 @@ typedef struct
|
|||
int lba48Support;
|
||||
char model[48];
|
||||
char serial[24];
|
||||
} typeDriveInfo ATTRIBUTE_ALIGN (32);
|
||||
} typeDriveInfo;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u16 type; //1 = master pw, 0 = user
|
||||
char password[32];
|
||||
u8 reserved[479];
|
||||
} unlockStruct ATTRIBUTE_ALIGN (32);
|
||||
u8 reserved[478];
|
||||
} unlockStruct;
|
||||
|
||||
extern typeDriveInfo ataDriveInfo;
|
||||
|
||||
|
|
|
@ -187,9 +187,9 @@ static struct {
|
|||
{ "smbipaddr", smbIpAddr, CONFIG_STRING_TYPE, CONFIG_STRING_TYPE },
|
||||
{ "rompath", romPath, CONFIG_STRING_TYPE, CONFIG_STRING_TYPE }
|
||||
};
|
||||
void handleConfigPair(char* kv);
|
||||
void readConfig(FILE* f);
|
||||
void writeConfig(FILE* f);
|
||||
void readArgs(int argc, char* argv[]);
|
||||
|
||||
extern "C" void gfx_set_fb(unsigned int* fb1, unsigned int* fb2);
|
||||
void gfx_set_window(int x, int y, int width, int height);
|
||||
|
@ -295,6 +295,8 @@ int main(int argc, char* argv[]){
|
|||
readConfig(f);
|
||||
fclose(f);
|
||||
}
|
||||
readArgs(argc, argv);
|
||||
|
||||
f = fopen( "fat:/not64/controlG.cfg", "r" ); //attempt to open file
|
||||
if(f) {
|
||||
load_configurations(f, &controller_GC); //write out GC controller mappings
|
||||
|
@ -342,7 +344,8 @@ int main(int argc, char* argv[]){
|
|||
fclose(f);
|
||||
}
|
||||
#endif //HW_RVL
|
||||
}
|
||||
} else
|
||||
readArgs(argc, argv);
|
||||
}
|
||||
else /*if((argv[0][0]=='s') || (argv[0][0]=='/'))*/
|
||||
#endif
|
||||
|
@ -356,6 +359,8 @@ int main(int argc, char* argv[]){
|
|||
readConfig(f);
|
||||
fclose(f);
|
||||
}
|
||||
readArgs(argc, argv);
|
||||
|
||||
f = fopen( "sd:/not64/controlG.cfg", "r" ); //attempt to open file
|
||||
if(f) {
|
||||
load_configurations(f, &controller_GC); //write out GC controller mappings
|
||||
|
@ -403,12 +408,8 @@ int main(int argc, char* argv[]){
|
|||
fclose(f);
|
||||
}
|
||||
#endif //HW_RVL
|
||||
}
|
||||
}
|
||||
// Handle options passed in through arguments
|
||||
int i;
|
||||
for(i=1; i<argc; ++i){
|
||||
handleConfigPair(argv[i]);
|
||||
} else
|
||||
readArgs(argc, argv);
|
||||
}
|
||||
|
||||
MenuContext *menu = new MenuContext(vmode);
|
||||
|
@ -795,3 +796,9 @@ void writeConfig(FILE* f){
|
|||
fprintf(f, "%s = %d\n", OPTIONS[i].key, *OPTIONS[i].value);
|
||||
}
|
||||
}
|
||||
|
||||
void readArgs(int argc, char* argv[]){
|
||||
for(int i=1; i<argc; ++i){
|
||||
handleConfigPair(argv[i]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -192,27 +192,27 @@ typedef struct {
|
|||
typedef union {
|
||||
DWORD Value;
|
||||
struct {
|
||||
unsigned R_DPAD : 1;
|
||||
unsigned L_DPAD : 1;
|
||||
unsigned D_DPAD : 1;
|
||||
unsigned U_DPAD : 1;
|
||||
unsigned START_BUTTON : 1;
|
||||
unsigned Z_TRIG : 1;
|
||||
unsigned B_BUTTON : 1;
|
||||
unsigned A_BUTTON : 1;
|
||||
unsigned B_BUTTON : 1;
|
||||
unsigned Z_TRIG : 1;
|
||||
unsigned START_BUTTON : 1;
|
||||
unsigned U_DPAD : 1;
|
||||
unsigned D_DPAD : 1;
|
||||
unsigned L_DPAD : 1;
|
||||
unsigned R_DPAD : 1;
|
||||
|
||||
unsigned R_CBUTTON : 1;
|
||||
unsigned L_CBUTTON : 1;
|
||||
unsigned D_CBUTTON : 1;
|
||||
unsigned U_CBUTTON : 1;
|
||||
unsigned R_TRIG : 1;
|
||||
unsigned L_TRIG : 1;
|
||||
unsigned Reserved1 : 1;
|
||||
unsigned Reserved2 : 1;
|
||||
|
||||
signed Y_AXIS : 8;
|
||||
|
||||
unsigned Reserved1 : 1;
|
||||
unsigned L_TRIG : 1;
|
||||
unsigned R_TRIG : 1;
|
||||
unsigned U_CBUTTON : 1;
|
||||
unsigned D_CBUTTON : 1;
|
||||
unsigned L_CBUTTON : 1;
|
||||
unsigned R_CBUTTON : 1;
|
||||
|
||||
signed X_AXIS : 8;
|
||||
|
||||
signed Y_AXIS : 8;
|
||||
};
|
||||
} BUTTONS;
|
||||
|
||||
|
|
|
@ -251,7 +251,6 @@ void ConfigureButtonsFrame::activateSubmenu(int submenu)
|
|||
if (submenu != SUBMENU_N64_PADNONE)
|
||||
{
|
||||
activePad = submenu;
|
||||
menu::Gui::getInstance().menuLogo->setVisible(false);
|
||||
}
|
||||
|
||||
//Fill out title text
|
||||
|
|
|
@ -231,10 +231,7 @@ void Func_AssignPad(int i)
|
|||
#ifdef HW_RVL
|
||||
case PADTYPE_WII:
|
||||
//Note: Wii expansion detection is done in InputStatusBar.cpp during MainFrame draw
|
||||
if (controller_Classic.available[(int)padAssign[i]])
|
||||
type = &controller_Classic;
|
||||
else
|
||||
type = &controller_WiimoteNunchuk;
|
||||
type = &controller_Wiimote;
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -121,6 +121,10 @@ extern void fileBrowserFrame_AutoLoadFile(char* path);
|
|||
void Func_LoadFromAuto()
|
||||
{
|
||||
if (!strlen(&romPath[0])) return;
|
||||
#ifdef HW_RVL
|
||||
if (!strncmp(&romPath[0], "usb", 3) && (romPath[3] == ':' || (isdigit(romPath[3]) && romPath[4] == ':')))
|
||||
strncpy(&romPath[0], "fat", 3);
|
||||
#endif
|
||||
strcpy(topLevel_libfat_Auto.name, &romPath[0]);
|
||||
char *sep = strrchr(topLevel_libfat_Auto.name, '/');
|
||||
if (sep)
|
||||
|
|
|
@ -167,13 +167,13 @@ void Func_Credits()
|
|||
strcat(CreditsInfo,"Not64 Build: " __DATE__ " " __TIME__ "\n");
|
||||
strcat(CreditsInfo,"Modified by Extrems' Corner.org\n");
|
||||
strcat(CreditsInfo,"\n");
|
||||
strcat(CreditsInfo,"Wii64 Team: www.emulatemii.com\n");
|
||||
strcat(CreditsInfo,"Wii64 Team:\n");
|
||||
strcat(CreditsInfo,"tehpola - core\n");
|
||||
strcat(CreditsInfo,"sepp256 - graphics & menu\n");
|
||||
strcat(CreditsInfo,"emu_kidid - general coding\n");
|
||||
strcat(CreditsInfo,"\n");
|
||||
strcat(CreditsInfo,"Special Thanks To:\n");
|
||||
strcat(CreditsInfo,"drmr - for menu graphics\n");
|
||||
strcat(CreditsInfo,"Special thanks to:\n");
|
||||
strcat(CreditsInfo,"drmr - menu graphics\n");
|
||||
#ifdef HW_RVL
|
||||
strcat(CreditsInfo,"Team Twiizers - for Wii homebrew\n");
|
||||
#endif
|
||||
|
@ -315,6 +315,7 @@ void Func_PlayGame()
|
|||
resume_netinit_thread();
|
||||
FRAME_BUTTONS[5].buttonString = FRAME_STRINGS[6];
|
||||
menu::Cursor::getInstance().clearCursorFocus();
|
||||
menu::Focus::getInstance().clearPrimaryFocus();
|
||||
}
|
||||
|
||||
void Func_SetPlayGame()
|
||||
|
|
|
@ -859,7 +859,7 @@ void Func_ConfigurePaks()
|
|||
|
||||
void Func_ConfigureButtons()
|
||||
{
|
||||
// menu::MessageBox::getInstance().setMessage("Controller Buttons not implemented");
|
||||
menu::Gui::getInstance().menuLogo->setVisible(false);
|
||||
pMenuContext->setActiveFrame(MenuContext::FRAME_CONFIGUREBUTTONS,ConfigureButtonsFrame::SUBMENU_N64_PADNONE);
|
||||
}
|
||||
|
||||
|
|
|
@ -215,11 +215,6 @@ static void release(int minNeeded){
|
|||
}
|
||||
|
||||
void RecompCache_Alloc(unsigned int size, unsigned int address, PowerPC_func* func){
|
||||
CacheMetaNode* newBlock = malloc( sizeof(CacheMetaNode) );
|
||||
newBlock->addr = address;
|
||||
newBlock->size = size;
|
||||
newBlock->func = func;
|
||||
|
||||
// Allocate new memory for this code
|
||||
void* code = __lwp_heap_allocate(cache, size);
|
||||
while(!code){
|
||||
|
@ -229,6 +224,11 @@ void RecompCache_Alloc(unsigned int size, unsigned int address, PowerPC_func* fu
|
|||
int num_instrs = (func->end_addr - func->start_addr) >> 2;
|
||||
void* code_addr = MetaCache_Alloc(num_instrs * sizeof(void*));
|
||||
|
||||
CacheMetaNode* newBlock = malloc(sizeof(CacheMetaNode));
|
||||
newBlock->addr = address;
|
||||
newBlock->size = size;
|
||||
newBlock->func = func;
|
||||
|
||||
cacheSize += size;
|
||||
newBlock->func->code = code;
|
||||
newBlock->func->code_addr = code_addr;
|
||||
|
|
Loading…
Reference in a new issue