Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
RSDuck authored Jun 12, 2023
2 parents e6b4ea5 + ca7fb4f commit 0523381
Show file tree
Hide file tree
Showing 39 changed files with 829 additions and 462 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-ubuntu-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
rm /etc/apt/sources.list
mv /etc/apt/sources.list{.new,}
apt update
DEBIAN_FRONTEND=noninteractive apt install -y {gcc-10,g++-10,pkg-config}-aarch64-linux-gnu {libsdl2,qtbase5,qtbase5-private,qtmultimedia5,libslirp,libarchive,liblua5.3}-dev:arm64 cmake extra-cmake-modules dpkg-dev
DEBIAN_FRONTEND=noninteractive apt install -y {gcc-10,g++-10,pkg-config}-aarch64-linux-gnu {libsdl2,qtbase5,qtbase5-private,qtmultimedia5,libslirp,libarchive,liblua5.3,libzstd}-dev:arm64 zstd:arm64 cmake extra-cmake-modules dpkg-dev
- name: Configure
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
run: |
sudo rm -f /etc/apt/sources.list.d/dotnetdev.list /etc/apt/sources.list.d/microsoft-prod.list
sudo apt update
sudo apt install cmake extra-cmake-modules libcurl4-gnutls-dev libpcap0.8-dev libsdl2-dev qt5-default qtbase5-private-dev qtmultimedia5-dev libslirp0 libslirp-dev libarchive-dev liblua5.3-dev --allow-downgrades
sudo apt install cmake extra-cmake-modules libcurl4-gnutls-dev libpcap0.8-dev libsdl2-dev qt5-default qtbase5-private-dev qtmultimedia5-dev libslirp0 libslirp-dev libarchive-dev liblua5.3-dev zstd libzstd-dev --allow-downgrades
- name: Create build environment
run: mkdir ${{runner.workspace}}/build
- name: Configure
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ As for the rest, the interface should be pretty straightforward. If you have a q

### Linux
1. Install dependencies:
* Ubuntu 22.04: `sudo apt install cmake extra-cmake-modules libcurl4-gnutls-dev libpcap0.8-dev libsdl2-dev qtbase5-dev qtbase5-private-dev qtmultimedia5-dev libslirp-dev libarchive-dev`
* Older Ubuntu: `sudo apt install cmake extra-cmake-modules libcurl4-gnutls-dev libpcap0.8-dev libsdl2-dev qt5-default qtbase5-private-dev qtmultimedia5-dev libslirp-dev libarchive-dev`
* Arch Linux: `sudo pacman -S base-devel cmake extra-cmake-modules git libpcap sdl2 qt5-base qt5-multimedia libslirp libarchive`
* Ubuntu 22.04: `sudo apt install cmake extra-cmake-modules libcurl4-gnutls-dev libpcap0.8-dev libsdl2-dev qtbase5-dev qtbase5-private-dev qtmultimedia5-dev libslirp-dev libarchive-dev libzstd-dev`
* Older Ubuntu: `sudo apt install cmake extra-cmake-modules libcurl4-gnutls-dev libpcap0.8-dev libsdl2-dev qt5-default qtbase5-private-dev qtmultimedia5-dev libslirp-dev libarchive-dev libzstd-dev`
* Arch Linux: `sudo pacman -S base-devel cmake extra-cmake-modules git libpcap sdl2 qt5-base qt5-multimedia libslirp libarchive zstd`
3. Download the melonDS repository and prepare:
```bash
git clone https://github.com/melonDS-emu/melonDS
Expand All @@ -64,7 +64,7 @@ As for the rest, the interface should be pretty straightforward. If you have a q
cd melonDS
```
#### Dynamic builds (with DLLs)
5. Install dependencies: `pacman -S mingw-w64-x86_64-{cmake,SDL2,toolchain,qt5-base,qt5-svg,qt5-multimedia,libslirp,libarchive}`
5. Install dependencies: `pacman -S mingw-w64-x86_64-{cmake,SDL2,toolchain,qt5-base,qt5-svg,qt5-multimedia,libslirp,libarchive,zstd}`
6. Compile:
```bash
cmake -B build
Expand All @@ -75,7 +75,7 @@ As for the rest, the interface should be pretty straightforward. If you have a q
If everything went well, melonDS and the libraries it needs should now be in the `dist` folder.

#### Static builds (without DLLs, standalone executable)
5. Install dependencies: `pacman -S mingw-w64-x86_64-{cmake,SDL2,toolchain,qt5-static,libslirp,libarchive}`
5. Install dependencies: `pacman -S mingw-w64-x86_64-{cmake,SDL2,toolchain,qt5-static,libslirp,libarchive,zstd}`
6. Compile:
```bash
cmake -B build -DBUILD_STATIC=ON -DCMAKE_PREFIX_PATH=/mingw64/qt5-static
Expand All @@ -85,7 +85,7 @@ If everything went well, melonDS should now be in the `build` folder.

### macOS
1. Install the [Homebrew Package Manager](https://brew.sh)
2. Install dependencies: `brew install git pkg-config cmake sdl2 qt@6 libslirp libarchive`
2. Install dependencies: `brew install git pkg-config cmake sdl2 qt@6 libslirp libarchive zstd`
3. Download the melonDS repository and prepare:
```zsh
git clone https://github.com/melonDS-emu/melonDS
Expand Down
6 changes: 6 additions & 0 deletions res/melon.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
<string>srl</string>
<string>dsi</string>
<string>ids</string>
<string>nds.zst</string>
<string>srl.zst</string>
<string>dsi.zst</string>
<string>ids.zst</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
Expand All @@ -50,6 +54,8 @@
<array>
<string>gba</string>
<string>agb</string>
<string>gba.zst</string>
<string>agb.zst</string>
</array>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
Expand Down
2 changes: 1 addition & 1 deletion src/ARCodeFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ using Platform::LogLevel;
// TODO: more user-friendly error reporting


ARCodeFile::ARCodeFile(std::string filename)
ARCodeFile::ARCodeFile(const std::string& filename)
{
Filename = filename;

Expand Down
2 changes: 1 addition & 1 deletion src/ARCodeFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ typedef std::list<ARCodeCat> ARCodeCatList;
class ARCodeFile
{
public:
ARCodeFile(std::string filename);
ARCodeFile(const std::string& filename);
~ARCodeFile();

bool Error;
Expand Down
4 changes: 2 additions & 2 deletions src/DSi_SD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@ void DSi_SDHost::CheckSwapFIFO()

#define MMC_DESC (Internal?"NAND":"SDcard")

DSi_MMCStorage::DSi_MMCStorage(DSi_SDHost* host, bool internal, std::string filename)
DSi_MMCStorage::DSi_MMCStorage(DSi_SDHost* host, bool internal, const std::string& filename)
: DSi_SDDevice(host)
{
Internal = internal;
Expand All @@ -780,7 +780,7 @@ DSi_MMCStorage::DSi_MMCStorage(DSi_SDHost* host, bool internal, std::string file
ReadOnly = false;
}

DSi_MMCStorage::DSi_MMCStorage(DSi_SDHost* host, bool internal, std::string filename, u64 size, bool readonly, std::string sourcedir)
DSi_MMCStorage::DSi_MMCStorage(DSi_SDHost* host, bool internal, const std::string& filename, u64 size, bool readonly, const std::string& sourcedir)
: DSi_SDDevice(host)
{
Internal = internal;
Expand Down
4 changes: 2 additions & 2 deletions src/DSi_SD.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,8 @@ class DSi_SDDevice
class DSi_MMCStorage : public DSi_SDDevice
{
public:
DSi_MMCStorage(DSi_SDHost* host, bool internal, std::string filename);
DSi_MMCStorage(DSi_SDHost* host, bool internal, std::string filename, u64 size, bool readonly, std::string sourcedir);
DSi_MMCStorage(DSi_SDHost* host, bool internal, const std::string& filename);
DSi_MMCStorage(DSi_SDHost* host, bool internal, const std::string& filename, u64 size, bool readonly, const std::string& sourcedir);
~DSi_MMCStorage();

void Reset();
Expand Down
27 changes: 14 additions & 13 deletions src/FATStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace fs = std::filesystem;
#endif // __WIN32__


FATStorage::FATStorage(std::string filename, u64 size, bool readonly, std::string sourcedir)
FATStorage::FATStorage(const std::string& filename, u64 size, bool readonly, const std::string& sourcedir)
{
ReadOnly = readonly;
Load(filename, size, sourcedir);
Expand Down Expand Up @@ -69,7 +69,7 @@ void FATStorage::Close()
}


bool FATStorage::InjectFile(std::string path, u8* data, u32 len)
bool FATStorage::InjectFile(const std::string& path, u8* data, u32 len)
{
if (!File) return false;
if (FF_File) return false;
Expand All @@ -89,9 +89,10 @@ bool FATStorage::InjectFile(std::string path, u8* data, u32 len)
return false;
}

path = "0:/" + path;
std::string prefixedPath("0:/");
prefixedPath += path;
FF_FIL file;
res = f_open(&file, path.c_str(), FA_CREATE_ALWAYS | FA_WRITE);
res = f_open(&file, prefixedPath.c_str(), FA_CREATE_ALWAYS | FA_WRITE);
if (res != FR_OK)
{
f_unmount("0:");
Expand Down Expand Up @@ -345,7 +346,7 @@ void FATStorage::SaveIndex()
}


bool FATStorage::ExportFile(std::string path, fs::path out)
bool FATStorage::ExportFile(const std::string& path, fs::path out)
{
FF_FIL file;
FILE* fout;
Expand Down Expand Up @@ -393,7 +394,7 @@ bool FATStorage::ExportFile(std::string path, fs::path out)
return true;
}

void FATStorage::ExportDirectory(std::string path, std::string outbase, int level)
void FATStorage::ExportDirectory(const std::string& path, const std::string& outbase, int level)
{
if (level >= 32) return;

Expand Down Expand Up @@ -492,7 +493,7 @@ void FATStorage::ExportDirectory(std::string path, std::string outbase, int leve
}
}

bool FATStorage::DeleteHostDirectory(std::string path, std::string outbase, int level)
bool FATStorage::DeleteHostDirectory(const std::string& path, const std::string& outbase, int level)
{
if (level >= 32) return false;

Expand Down Expand Up @@ -565,7 +566,7 @@ bool FATStorage::DeleteHostDirectory(std::string path, std::string outbase, int
return true;
}

void FATStorage::ExportChanges(std::string outbase)
void FATStorage::ExportChanges(const std::string& outbase)
{
// reflect changes in the FAT volume to the host filesystem
// * delete directories and files that exist in the index but not in the volume
Expand Down Expand Up @@ -652,7 +653,7 @@ bool FATStorage::CanFitFile(u32 len)
return (freeclusters >= len);
}

bool FATStorage::DeleteDirectory(std::string path, int level)
bool FATStorage::DeleteDirectory(const std::string& path, int level)
{
if (level >= 32) return false;
if (path.length() < 1) return false;
Expand Down Expand Up @@ -710,7 +711,7 @@ bool FATStorage::DeleteDirectory(std::string path, int level)
return true;
}

void FATStorage::CleanupDirectory(std::string sourcedir, std::string path, int level)
void FATStorage::CleanupDirectory(const std::string& sourcedir, const std::string& path, int level)
{
if (level >= 32) return;

Expand Down Expand Up @@ -778,7 +779,7 @@ void FATStorage::CleanupDirectory(std::string sourcedir, std::string path, int l
}
}

bool FATStorage::ImportFile(std::string path, fs::path in)
bool FATStorage::ImportFile(const std::string& path, fs::path in)
{
FF_FIL file;
FILE* fin;
Expand Down Expand Up @@ -825,7 +826,7 @@ bool FATStorage::ImportFile(std::string path, fs::path in)
return true;
}

bool FATStorage::ImportDirectory(std::string sourcedir)
bool FATStorage::ImportDirectory(const std::string& sourcedir)
{
// remove whatever isn't in the index
CleanupDirectory(sourcedir, "", 0);
Expand Down Expand Up @@ -938,7 +939,7 @@ u64 FATStorage::GetDirectorySize(fs::path sourcedir)
return ret;
}

bool FATStorage::Load(std::string filename, u64 size, std::string sourcedir)
bool FATStorage::Load(const std::string& filename, u64 size, const std::string& sourcedir)
{
FilePath = filename;
FileSize = size;
Expand Down
22 changes: 11 additions & 11 deletions src/FATStorage.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
class FATStorage
{
public:
FATStorage(std::string filename, u64 size, bool readonly, std::string sourcedir);
FATStorage(const std::string& filename, u64 size, bool readonly, const std::string& sourcedir);
~FATStorage();

bool Open();
void Close();

bool InjectFile(std::string path, u8* data, u32 len);
bool InjectFile(const std::string& path, u8* data, u32 len);

u32 ReadSectors(u32 start, u32 num, u8* data);
u32 WriteSectors(u32 start, u32 num, u8* data);
Expand All @@ -62,19 +62,19 @@ class FATStorage
void LoadIndex();
void SaveIndex();

bool ExportFile(std::string path, std::filesystem::path out);
void ExportDirectory(std::string path, std::string outbase, int level);
bool DeleteHostDirectory(std::string path, std::string outbase, int level);
void ExportChanges(std::string outbase);
bool ExportFile(const std::string& path, std::filesystem::path out);
void ExportDirectory(const std::string& path, const std::string& outbase, int level);
bool DeleteHostDirectory(const std::string& path, const std::string& outbase, int level);
void ExportChanges(const std::string& outbase);

bool CanFitFile(u32 len);
bool DeleteDirectory(std::string path, int level);
void CleanupDirectory(std::string sourcedir, std::string path, int level);
bool ImportFile(std::string path, std::filesystem::path in);
bool ImportDirectory(std::string sourcedir);
bool DeleteDirectory(const std::string& path, int level);
void CleanupDirectory(const std::string& sourcedir, const std::string& path, int level);
bool ImportFile(const std::string& path, std::filesystem::path in);
bool ImportDirectory(const std::string& sourcedir);
u64 GetDirectorySize(std::filesystem::path sourcedir);

bool Load(std::string filename, u64 size, std::string sourcedir);
bool Load(const std::string& filename, u64 size, const std::string& sourcedir);
bool Save();

typedef struct
Expand Down
2 changes: 1 addition & 1 deletion src/NDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ bool NeedsDirectBoot()
}
}

void SetupDirectBoot(std::string romname)
void SetupDirectBoot(const std::string& romname)
{
if (ConsoleType == 1)
{
Expand Down
2 changes: 1 addition & 1 deletion src/NDS.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ void EjectCart();
bool CartInserted();

bool NeedsDirectBoot();
void SetupDirectBoot(std::string romname);
void SetupDirectBoot(const std::string& romname);

bool LoadGBACart(const u8* romdata, u32 romlen, const u8* savedata, u32 savelen);
void LoadGBAAddon(int type);
Expand Down
Loading

0 comments on commit 0523381

Please sign in to comment.