Always assume there's a first controller.

Fixed copying name from ROM header.
Adjusted for libogc-rice changes.
Synchronized changes from Swiss.
This commit is contained in:
Extrems 2023-11-02 19:19:44 -04:00
parent 487a0d30fb
commit 745a66a377
6 changed files with 352 additions and 312 deletions

View file

@ -104,7 +104,7 @@ EXPORT void CALL AiLenChanged(void)
}
if (scalePitch || Timers.vis > VILimit)
AESND_SetVoiceFrequency(voice, freq * (Timers.vis / VILimit));
AESND_SetVoiceFrequencyRatio(voice, (Timers.vis * freq) / (VILimit * DSP_DEFAULT_FREQ));
IRQ_Restore(level);
}

View file

@ -424,9 +424,21 @@ void auto_assign_controllers(void){
// 'Initialize' the unmapped virtual controllers
for(; i<4; ++i){
unassign_controller(i);
padType[i] = PADTYPE_NONE;
padAssign[i] = i;
if(i == 0){
#ifdef HW_RVL
assign_controller(i, &controller_Wiimote, i);
padType[i] = PADTYPE_WII;
padAssign[i] = i;
#else
assign_controller(i, &controller_GC, i);
padType[i] = PADTYPE_GAMECUBE;
padAssign[i] = i;
#endif
} else {
unassign_controller(i);
padType[i] = PADTYPE_NONE;
padAssign[i] = i;
}
}
}

View file

@ -181,7 +181,7 @@ void gSPProcessVertex( u32 v )
#ifndef __GX__
Normalize( &gSP.vertices[v].nx );
#else //!__GX__
guVecNormalize((guVector*) &gSP.vertices[v].nx );
guVecNormalize((guVector*) &gSP.vertices[v].nx,(guVector*) &gSP.vertices[v].nx );
#endif //__GX__
r = gSP.lights[gSP.numLights].r;
@ -219,7 +219,7 @@ void gSPProcessVertex( u32 v )
#ifndef __GX__
Normalize( &gSP.vertices[v].nx );
#else //!__GX__
guVecNormalize((guVector*) &gSP.vertices[v].nx );
guVecNormalize((guVector*) &gSP.vertices[v].nx,(guVector*) &gSP.vertices[v].nx );
#endif //__GX__
if (gSP.geometryMode & G_TEXTURE_GEN_LINEAR)
@ -482,7 +482,7 @@ void gSPLight( u32 l, s32 n )
#ifndef __GX__
Normalize( &gSP.lights[n].x );
#else //!__GX__
guVecNormalize((guVector*) &gSP.lights[n].x );
guVecNormalize((guVector*) &gSP.lights[n].x,(guVector*) &gSP.lights[n].x );
#endif //__GX__
}

View file

@ -17,6 +17,7 @@
#define IDE_EXI_V1 0
#define IDE_EXI_V2 1
#define IDE_EXI_V3 2
u16 buffer[256] ATTRIBUTE_ALIGN (32);
static int __ata_init[3] = {0,0,0};
@ -153,7 +154,7 @@ static inline void ata_read_buffer(int chn, u32 *dst)
}
else {
// IDE_EXI_V2, no need to select / deselect all the time
EXI_ImmEx(chn,dst,512,EXI_READ);
EXI_DmaEx(chn,dst,512,EXI_READ);
EXI_Deselect(chn);
EXI_Unlock(chn);
}
@ -172,7 +173,7 @@ static inline void ata_write_buffer(int chn, u32 *src)
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);
EXI_DmaEx(chn, src,512,EXI_WRITE);
dat = 0;
EXI_ImmEx(chn,&dat,1,EXI_WRITE); // Burn an extra cycle for the IDE-EXI to know to stop serving data
EXI_Deselect(chn);
@ -187,8 +188,8 @@ int _ideExiVersion(int chn) {
}
u32 cid = 0;
EXI_GetID(chn,dev,&cid);
if(cid==0x49444532) {
return IDE_EXI_V2;
if((cid&~0xff)==0x49444500) {
return (cid&0xff)-'1';
}
else {
return IDE_EXI_V1;
@ -204,7 +205,7 @@ u32 _ataDriveIdentify(int chn) {
memset(&ataDriveInfo, 0, sizeof(typeDriveInfo));
// Get the ID to see if it's a V2
// 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;
@ -433,9 +434,14 @@ int _ataWriteSector(int chn, u64 lba, u32 *Buffer)
while(!(ataReadStatusReg(chn) & ATA_SR_DRQ));
// Write data to the drive
u16 *ptr = (u16*)Buffer;
for (i=0; i<256; i++) {
ataWriteu16(chn, ptr[i]);
if(_ideexi_version < IDE_EXI_V3) {
u16 *ptr = (u16*)Buffer;
for (i=0; i<256; i++) {
ataWriteu16(chn, ptr[i]);
}
}
else {
ata_write_buffer(chn, Buffer);
}
// Wait for the write to finish

View file

@ -135,7 +135,6 @@ bool isEEPROM16k()
/* Loads the ROM into the ROM cache */
int rom_read(fileBrowser_file* file){
char buffer[1024];
int i;
ROMCache_init(file);
@ -147,14 +146,13 @@ int rom_read(fileBrowser_file* file){
ROMCache_read(&ROM_HEADER, 0, sizeof(rom_header));
//Copy header name as Goodname (in the .ini we can use CRC to identify ROMS)
memset((char*)buffer,0,1024);
strncpy(buffer, (char*)ROM_HEADER.Name,32);
//Maximum ROM name is 32 bytes. Lets make sure we cut off trailing spaces
for(i = strlen(buffer); i>0; i--)
memcpy(ROM_SETTINGS.goodname, ROM_HEADER.Name, 20);
ROM_SETTINGS.goodname[20] = '\0';
//Maximum ROM name is 20 bytes. Lets make sure we cut off trailing spaces
for(i = strlen(ROM_SETTINGS.goodname); i>0; i--)
{
if(buffer[i-1] != ' ') {
strncpy(&ROM_SETTINGS.goodname[0],&buffer[0],i);
ROM_SETTINGS.goodname[i] = 0; //terminate it too
if(ROM_SETTINGS.goodname[i-1] != ' ') {
ROM_SETTINGS.goodname[i] = '\0';
break;
}
}

File diff suppressed because it is too large Load diff