Assorted portability enhancements (#1800)

* Introduce some Platform calls for managing dynamic libraries

* Add Platform::WriteFATSectors

* Introduce some Platform calls for managing dynamic libraries

* Add Platform::WriteFATSectors

* Change includes of "../types.h" to "types.h"

- Makes it easier to directly include these headers in downstream projects

* Change an include of "../Wifi.h" to "Wifi.h"

* Allow CommonFuncs.cpp to compile on Android

* Tidy up some logging calls

- Use Platform::Log in LAN_Socket.cpp
- Soften some warnings to Debug logs (since they don't necessarily represent problems)

* Add Platform::EnterGBAMode

- Gracefully stop the emulator if trying to enter GBA mode

* Soften some logs that most players won't care about

* Soften some more logs

* Introduce Platform wrappers for file operations

* Fix pointer spacing

* Fix more style nits

* Log the errno when ftruncate fails

* Fix FileSeek offset argument

- With an s32 offset, we couldn't access files larger than 2GB

* Revise Platform::StopEmu to address feedback

- Remove Platform::EnterGBAMode in favor of adding a reason to Platform::StopEmu
- Also rename Platform::StopEmu to Platform::SignalStop
- Add an optional argument to NDS::Stop
- Use the new argument everywhere that the console stops itself

* Rename FileGetString to FileReadLine

- It conveys the meaning better

* Rename FileSeekOrigin::Set to Start

- It conveys the meaning better

* Change definition of FileGetString to FileReadLine

- Oops, almost forgot it

* Rename FlushFile to FileFlush

- To remain consistent with the other File functions

* Add a FileType usage

* Fix line break in FileSeekOrigin

* Document Platform::DeInit

* Clarify that StopReason::Unknown doesn't always mean an error

* Move and document FileType::HostFile

* Remove Platform::OpenDataFile

- Nothing currently uses it

* Refactor Platform::OpenFile and Platform::OpenLocalFile to accept a FileMode enum instead of a string

- The enum is converted to fopen flags under the hood
- The file type is used to decide whether to add the "b" flag
- Some helper functions are exposed for the benefit of consistent behavior among frontends
- Equivalent behavior is maintained

* Fix a tab that should be spaces

* Use Windows' 64-bit implementations of fseek/ftell

* Move Platform::IsBinaryFile to Platform.cpp

- It could vary by frontend

* Remove an unused FileType

* Rename an enum constant

* Document various Platform items

* Use Platform::DynamicLibrary to load libandroid

- And clean it up at the end

* Fix a typo

* Pass the correct filetype to FATStorage

- Since it can be used for DSI NAND images or for SD cards

* Remove Platform::FileType
This commit is contained in:
Jesse Talavera-Greenberg
2023-08-18 16:50:57 -04:00
committed by GitHub
parent f454eba3c3
commit ee55677086
36 changed files with 787 additions and 443 deletions

View File

@ -247,7 +247,7 @@ u8 Read8(u32 addr)
{
//
Log(LogLevel::Warn, "unknown DSi cam read8 %08X\n", addr);
Log(LogLevel::Debug, "unknown DSi cam read8 %08X\n", addr);
return 0;
}
@ -259,7 +259,7 @@ u16 Read16(u32 addr)
case 0x04004202: return Cnt;
}
Log(LogLevel::Warn, "unknown DSi cam read16 %08X\n", addr);
Log(LogLevel::Debug, "unknown DSi cam read16 %08X\n", addr);
return 0;
}
@ -285,7 +285,7 @@ u32 Read32(u32 addr)
case 0x04004214: return CropEnd;
}
Log(LogLevel::Warn, "unknown DSi cam read32 %08X\n", addr);
Log(LogLevel::Debug, "unknown DSi cam read32 %08X\n", addr);
return 0;
}
@ -293,7 +293,7 @@ void Write8(u32 addr, u8 val)
{
//
Log(LogLevel::Warn, "unknown DSi cam write8 %08X %02X\n", addr, val);
Log(LogLevel::Debug, "unknown DSi cam write8 %08X %02X\n", addr, val);
}
void Write16(u32 addr, u16 val)
@ -372,7 +372,7 @@ void Write16(u32 addr, u16 val)
return;
}
Log(LogLevel::Warn, "unknown DSi cam write16 %08X %04X\n", addr, val);
Log(LogLevel::Debug, "unknown DSi cam write16 %08X %04X\n", addr, val);
}
void Write32(u32 addr, u32 val)
@ -389,7 +389,7 @@ void Write32(u32 addr, u32 val)
return;
}
Log(LogLevel::Warn, "unknown DSi cam write32 %08X %08X\n", addr, val);
Log(LogLevel::Debug, "unknown DSi cam write32 %08X %08X\n", addr, val);
}
@ -638,7 +638,7 @@ u16 Camera::I2C_ReadReg(u16 addr)
case 0x301A: return ((~StandbyCnt) & 0x4000) >> 12;
}
if(Num==1) Log(LogLevel::Warn, "DSi_Camera%d: unknown read %04X\n", Num, addr);
if(Num==1) Log(LogLevel::Debug, "DSi_Camera%d: unknown read %04X\n", Num, addr);
return 0;
}
@ -704,7 +704,7 @@ void Camera::I2C_WriteReg(u16 addr, u16 val)
return;
}
if(Num==1) Log(LogLevel::Warn, "DSi_Camera%d: unknown write %04X %04X\n", Num, addr, val);
if(Num==1) Log(LogLevel::Debug, "DSi_Camera%d: unknown write %04X %04X\n", Num, addr, val);
}