Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: XMU Settings #1315

Merged
merged 34 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
96157f6
Added XMU Settings to the Input Screen
faha223 Dec 31, 2022
766409f
Added Peripherals to config
faha223 Jan 2, 2023
3f9b265
Prevent overwriting existing XMUs
faha223 Jan 8, 2023
8e3296b
Added blockdev.h to try to fix the MacOS build
faha223 Jan 10, 2023
51fe070
Merge pull request #12 from xemu-project/master
faha223 Jan 17, 2023
21d467a
Merge pull request #15 from xemu-project/master
faha223 Jan 18, 2023
b1f9085
Fixed some issues that antangelo pointed out
faha223 Jan 19, 2023
a9747a0
Moved the peripheralType and param vars into the loop
faha223 Jan 19, 2023
ac3b36d
Merge branch 'master' into xmu-settings2
faha223 Jan 19, 2023
485cb9c
Moved fatx.h and fatx.c to ui\thirdparty\fatx
faha223 Jan 21, 2023
bd1e773
Merge branch 'xmu-settings2' of https://github.com/faha223/xemu into …
faha223 Jan 21, 2023
bc80676
Added Validation for Peripheral Settings
faha223 Jan 23, 2023
1e0595e
Fixed some nits that were pointed out
faha223 Jun 8, 2023
f397226
Merge pull request #18 from xemu-project/master
faha223 Jun 8, 2023
8423130
Merge branch 'xmu-settings2' into master
faha223 Jun 8, 2023
70881db
Merge pull request #19 from faha223/master
faha223 Jun 8, 2023
afe5146
don't pass NULL into xemu_settings_set_string
faha223 Jun 8, 2023
5def7ad
Changes following Matt's recommendations
faha223 Jun 9, 2023
f966217
Changes to XMU FilePicker
faha223 Jun 12, 2023
3167c43
XMU image auto-bind logic refactor
faha223 Jun 13, 2023
8889047
renamed peripheralType to peripheral_type
faha223 Jun 13, 2023
85b7071
removed unnecessary calls to g_strdup_printf and g_free
faha223 Jun 13, 2023
32fe45a
Cleaned up some comments, removed an unnecessary variable
faha223 Jun 13, 2023
a7f9905
handle overwrite prompt in Windows
faha223 Jun 13, 2023
e372b5a
Merge branch 'master' into xmu-settings2
faha223 Aug 20, 2023
498a44a
Fixed some code format and style inconsistencies
faha223 Oct 30, 2023
e74066e
More formatting fixes
faha223 Oct 30, 2023
97d37c0
Fixed a few memory leaks
faha223 Oct 31, 2023
93fc4a0
qemu_access: check for Read and Write access
faha223 Nov 3, 2023
a8a9678
Merge branch 'master' of https://github.com/xemu-project/xemu into xm…
faha223 Nov 23, 2023
9d43196
Run clang-format
antangelo Dec 17, 2023
51422f0
Remove unused xemu_new_xmu declaration
antangelo Dec 17, 2023
60c2362
Merge remote-tracking branch 'upstream/master' into xmu-settings2
antangelo Dec 17, 2023
4677199
Fix use after free in rebind code
antangelo Dec 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions config_spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,27 @@ input:
port2: string
port3: string
port4: string
peripherals:
port1:
peripheral_type_0: integer
peripheral_param_0: string
peripheral_type_1: integer
peripheral_param_1: string
port2:
peripheral_type_0: integer
peripheral_param_0: string
peripheral_type_1: integer
peripheral_param_1: string
port3:
peripheral_type_0: integer
peripheral_param_0: string
peripheral_type_1: integer
peripheral_param_1: string
port4:
peripheral_type_0: integer
peripheral_param_0: string
peripheral_type_1: integer
peripheral_param_1: string
gamecontrollerdb_path: string
auto_bind:
type: bool
Expand Down
1 change: 1 addition & 0 deletions data/meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pfiles = [
'controller_mask.png',
'xmu_mask.png',
'logo_sdf.png',
'xemu_64x64.png',
'abxy.ttf',
Expand Down
Binary file added data/xmu_mask.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ui/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ endif
xemu_ss.add(when: 'CONFIG_LINUX', if_true: [gtk, files('xemu-os-utils-linux.c')])
xemu_ss.add(when: 'CONFIG_WIN32', if_true: files('xemu-os-utils-windows.c'))
xemu_ss.add(when: 'CONFIG_DARWIN', if_true: files('xemu-os-utils-macos.m'))
xemu_ss.add(imgui, implot, stb_image, noc, sdl, opengl, openssl, fa, fpng, json, httplib)
xemu_ss.add(imgui, implot, stb_image, noc, sdl, opengl, openssl, fa, fpng, json, httplib, fatx)

softmmu_ss.add_all(xemu_ss)

Expand Down
51 changes: 51 additions & 0 deletions ui/thirdparty/fatx/fatx.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include "fatx.h"

#include "qemu/bswap.h"

#define FATX_SIGNATURE 0x58544146

// This is from libfatx
#pragma pack(1)
struct fatx_superblock {
uint32_t signature;
uint32_t volume_id;
uint32_t sectors_per_cluster;
uint32_t root_cluster;
uint16_t unknown1;
uint8_t padding[4078];
};
#pragma pack()

bool create_fatx_image(const char *filename, unsigned int size)
{
unsigned int empty_fat = cpu_to_le32(0xfffffff8);
unsigned char zero = 0;

FILE *fp = qemu_fopen(filename, "wb");
if (fp != NULL) {
struct fatx_superblock superblock;
memset(&superblock, 0xff, sizeof(struct fatx_superblock));

superblock.signature = cpu_to_le32(FATX_SIGNATURE);
superblock.sectors_per_cluster = cpu_to_le32(4);
superblock.volume_id = (uint32_t)rand();
superblock.root_cluster = cpu_to_le32(1);
superblock.unknown1 = 0;

// Write the fatx superblock.
fwrite(&superblock, sizeof(superblock), 1, fp);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation depends on host byte order being little endian. Can you rework it so it will also work on BE hosts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed the code to use cpu_to_le32(u32) on the unsigned integers that were being written to the superblock. I think that will work but I don't have a BE machine to test on. It doesn't break this functionality on my machine.


// Write the FAT
fwrite(&empty_fat, sizeof(empty_fat), 1, fp);

fseek(fp, size - sizeof(unsigned char), SEEK_SET);
fwrite(&zero, sizeof(unsigned char), 1, fp);

fflush(fp);
fclose(fp);

return true;
}

return false;
}
16 changes: 16 additions & 0 deletions ui/thirdparty/fatx/fatx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef FATX_H
#define FATX_H

#include "qemu/osdep.h"

#ifdef __cplusplus
extern "C" {
#endif

bool create_fatx_image(const char *filename, unsigned int size);

#ifdef __cplusplus
}
#endif

#endif
3 changes: 3 additions & 0 deletions ui/thirdparty/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,6 @@ fpng = declare_dependency(include_directories: 'fpng', link_with: libfpng)

json = declare_dependency(include_directories: 'json')
httplib = declare_dependency(include_directories: 'httplib')

libfatx = static_library('fatx', sources: 'fatx/fatx.c')
fatx = declare_dependency(include_directories: 'fatx', link_with: libfatx)
3 changes: 3 additions & 0 deletions ui/thirdparty/noc_file_dialog/noc_file_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ const char *noc_file_dialog_open(int flags,
ofn.lpstrInitialDir = initialDir;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR;

if (flags & NOC_FILE_DIALOG_OVERWRITE_CONFIRMATION)
ofn.Flags |= OFN_OVERWRITEPROMPT;

if (flags & NOC_FILE_DIALOG_OPEN) {
ret = GetOpenFileNameW(&ofn);
} else {
Expand Down
Loading