diff --git a/README.md b/README.md
index 5429ee9..b4851f7 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
[](https://github.com/Diesel-Net/kiwi-8/actions/workflows/lint.yml)
-
+
A cross-platform Chip-8 interpreter written
in C-style C++ using SDL2, ImGui, and OpenGL.
@@ -73,7 +73,7 @@ The following must be installed and added to your **PATH**:
1. Change current working directory
```cmd
- cd Windows
+ cd windows
```
1. Configure environment for your architecture (x64 or arm64)
@@ -94,6 +94,7 @@ The following must be installed and added to your **PATH**:
>install_name_tool
>clang
+>clang++
>python3
>cmake
>make
@@ -101,7 +102,7 @@ The following must be installed and added to your **PATH**:
1. Change current working directory
```bash
- cd MacOS
+ cd macos
```
1. Compile with GNU's `make` utility
@@ -114,6 +115,7 @@ The following must be installed and added to your **PATH**:
The following must be added to your **PATH**:
+>gcc
>g++
>make
>cmake
@@ -123,7 +125,7 @@ The following must be added to your **PATH**:
You'll also need the GTK3, openGL, PulseAudio/Pipewire headers:
```bash
-sudo apt install libgtk-3-dev xorg-dev libgl1-mesa-dev libasound2-dev libpulse-dev libpipewire-0.3-dev libdbus-1-dev
+sudo apt install libgtk-3-dev xorg-dev libgl1-mesa-dev libasound2-dev libpulse-dev libjack-dev libpipewire-0.3-dev libdbus-1-dev
```
1. Change current working directory
diff --git a/images/screenshots/astrodoge_macos.png b/images/screenshots/astrodoge_macos.png
new file mode 100644
index 0000000..95160fa
Binary files /dev/null and b/images/screenshots/astrodoge_macos.png differ
diff --git a/images/screenshots/boot_linux.png b/images/screenshots/boot_linux.png
new file mode 100644
index 0000000..62d438d
Binary files /dev/null and b/images/screenshots/boot_linux.png differ
diff --git a/images/screenshots/boot_macos.png b/images/screenshots/boot_macos.png
new file mode 100644
index 0000000..afc4f13
Binary files /dev/null and b/images/screenshots/boot_macos.png differ
diff --git a/images/screenshots/boot.png b/images/screenshots/boot_windows.png
similarity index 100%
rename from images/screenshots/boot.png
rename to images/screenshots/boot_windows.png
diff --git a/linux/src/open_file_dialog.cc b/linux/src/open_file_dialog.cc
index 368112b..bb9d2fa 100644
--- a/linux/src/open_file_dialog.cc
+++ b/linux/src/open_file_dialog.cc
@@ -69,11 +69,11 @@ std::vector open_file_dialog(const std::string &title, const std::s
return result;
}
-int open_file_dialog(char *rom_filepath) {
+int open_file_dialog(char *rom_filepath, size_t size) {
std::vector fileTypes = {"ch8", "CH8", "chip-8", "CHIP-8", "Chip-8"};
const char* defaultDir = ""; // unify behavior: let OS choose last-used/home
std::vector files = open_file_dialog("Chip8", defaultDir, fileTypes);
if (files.empty()) return 1;
- snprintf(rom_filepath, PATH_MAX, "%s", files[0].c_str());
+ snprintf(rom_filepath, size, "%s", files[0].c_str());
return 0;
}
diff --git a/macos/src/open_file_dialog.mm b/macos/src/open_file_dialog.mm
index adf60c8..cbabe66 100644
--- a/macos/src/open_file_dialog.mm
+++ b/macos/src/open_file_dialog.mm
@@ -44,11 +44,11 @@
return fileList;
}
-int open_file_dialog(char *rom_filepath) {
+int open_file_dialog(char *rom_filepath, size_t size) {
std::vector fileTypes = {"ch8", "CH8", "chip-8", "CHIP-8", "Chip-8"};
const char* defaultDir = ""; // unify behavior: let OS choose last-used/home
std::vector files = open_file_dialog("Chip8", defaultDir, fileTypes);
if (files.empty()) return 1;
- snprintf(rom_filepath, PATH_MAX, "%s", files[0].c_str());
+ snprintf(rom_filepath, size, "%s", files[0].c_str());
return 0;
}
diff --git a/shared/chip8.c b/shared/chip8.c
index a8f433a..65c0b48 100644
--- a/shared/chip8.c
+++ b/shared/chip8.c
@@ -198,7 +198,7 @@ int chip8_load_rom(const char *rom_filepath) {
} else {
/* load ROM from GUI */
char new_rom_filepath[PATH_MAX];
- open_file_dialog(new_rom_filepath) ?
+ open_file_dialog(new_rom_filepath, sizeof(new_rom_filepath)) ?
printf("User aborted the open file dialog.\n") :
chip8_load_rom(new_rom_filepath);
diff --git a/shared/open_file_dialog.h b/shared/open_file_dialog.h
index bcfabcb..5c5a565 100644
--- a/shared/open_file_dialog.h
+++ b/shared/open_file_dialog.h
@@ -5,7 +5,14 @@
extern "C" {
#endif
-int open_file_dialog(char *rom_filepath);
+#include
+
+/* Opens a file dialog to select a ROM file.
+ * The selected file path is copied to `rom_filepath`.
+ * The `size` parameter specifies the size of the `rom_filepath` buffer.
+ * Returns 1 if a file was selected, 0 if cancelled, or -1 on error.
+ */
+int open_file_dialog(char *rom_filepath, size_t size);
#ifdef __cplusplus
}
diff --git a/windows/src/open_file_dialog.cc b/windows/src/open_file_dialog.cc
index 459715f..0a9cfa5 100644
--- a/windows/src/open_file_dialog.cc
+++ b/windows/src/open_file_dialog.cc
@@ -5,7 +5,7 @@
#include
#include
-int open_file_dialog(char *rom_filepath, char *filters) {
+int open_file_dialog(char *rom_filepath, char *filters, size_t size) {
/* open file dialogue */
char cwd[PATH_MAX];
GetCurrentDirectory(PATH_MAX, cwd);
@@ -36,10 +36,10 @@ int open_file_dialog(char *rom_filepath, char *filters) {
return 1;
}
- strcpy(rom_filepath, szFile);
+ strncpy(rom_filepath, szFile, size);
return 0;
}
-int open_file_dialog(char *rom_filepath) {
- return open_file_dialog(rom_filepath, "Chip8\0*.ch8\0All\0*.*\0");
+int open_file_dialog(char *rom_filepath, size_t size) {
+ return open_file_dialog(rom_filepath, "Chip8\0*.ch8\0All\0*.*\0", size);
}