forked from xemu-project/xemu
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ui: Support controller peripherals and XMU devices (xemu-project#1315)
* Added XMU Settings to the Input Screen * Added Peripherals to config * Prevent overwriting existing XMUs * Added blockdev.h to try to fix the MacOS build * Fixed some issues that antangelo pointed out * Moved the peripheralType and param vars into the loop * Moved fatx.h and fatx.c to ui\thirdparty\fatx * Added Validation for Peripheral Settings * Fixed some nits that were pointed out * don't pass NULL into xemu_settings_set_string * Changes following Matt's recommendations * Changes to XMU FilePicker * XMU image auto-bind logic refactor * renamed peripheralType to peripheral_type * removed unnecessary calls to g_strdup_printf and g_free * Cleaned up some comments, removed an unnecessary variable * handle overwrite prompt in Windows * Fixed some code format and style inconsistencies * More formatting fixes * Fixed a few memory leaks * qemu_access: check for Read and Write access * Run clang-format * Remove unused xemu_new_xmu declaration * Fix use after free in rebind code
- Loading branch information
Showing
13 changed files
with
769 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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', | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
|
||
// 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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.