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

iso_loader: add device support to preset #11

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 16 additions & 14 deletions applications/iso_loader/modules/module.c
Expand Up @@ -328,19 +328,19 @@ static void get_md5_hash(const char *mountpoint) {

if(fd != FILEHND_INVALID) {

if(fs_ioctl(fd, self.boot_sector, ISOFS_IOCTL_GET_BOOT_SECTOR_DATA) < 0) {
if(fs_ioctl(fd, (int) self.boot_sector, ISOFS_IOCTL_GET_BOOT_SECTOR_DATA) < 0) {
memset(self.md5, 0, sizeof(self.md5));
memset(self.boot_sector, 0, sizeof(self.boot_sector));
} else {
kos_md5(self.boot_sector, sizeof(self.boot_sector), self.md5);
}

/* Also get image type and sector size */
if(fs_ioctl(fd, &self.image_type, ISOFS_IOCTL_GET_IMAGE_TYPE) < 0) {
if(fs_ioctl(fd, (int) &self.image_type, ISOFS_IOCTL_GET_IMAGE_TYPE) < 0) {
ds_printf("%s: Can't get image type\n", lib_get_name());
}

if(fs_ioctl(fd, &self.sector_size, ISOFS_IOCTL_GET_DATA_TRACK_SECTOR_SIZE) < 0) {
if(fs_ioctl(fd, (int) &self.sector_size, ISOFS_IOCTL_GET_DATA_TRACK_SECTOR_SIZE) < 0) {
ds_printf("%s: Can't get sector size\n", lib_get_name());
}

Expand Down Expand Up @@ -544,7 +544,7 @@ void isoLoader_MakeShortcut(GUI_Widget *widget)

tmpval = GUI_TextEntryGetText(self.device);

if(strncasecmp(tmpval, "auto", 4))
if(strncasecmp(tmpval, "auto", 4) != 0)
{
strcat(cmd, " -d ");
strcat(cmd, tmpval);
Expand Down Expand Up @@ -960,7 +960,7 @@ void isoLoader_Run(GUI_Widget *widget) {

tmpval = GUI_TextEntryGetText(self.device);

if(strncasecmp(tmpval, "auto", 4)) {
if(strncasecmp(tmpval, "auto", 4) != 0) {
strncpy(self.isoldr->fs_dev, tmpval, sizeof(self.isoldr->fs_dev));
}

Expand Down Expand Up @@ -1262,7 +1262,7 @@ int isoLoader_SavePreset() {
file_t fd;
ipbin_meta_t *ipbin = (ipbin_meta_t *)self.boot_sector;
char text[32];
char result[512];
char result[1024];
int async = 0, type = 0, mode = 0;

filename = makePresetFilename();
Expand Down Expand Up @@ -1326,8 +1326,8 @@ int isoLoader_SavePreset() {
memset(result, 0, sizeof(result));

snprintf(result, sizeof(result),
"title = %s\ndma = %d\nasync = %d\ncdda = %d\nfastboot = %d\ntype = %d\nmode = %d\nmemory = %s\npa1 = %08lx\npv1 = %08lx\npa2 = %08lx\npv2 = %08lx\n",
text, GUI_WidgetGetState(self.dma), async,
"title = %s\ndevice = %s\ndma = %d\nasync = %d\ncdda = %d\nfastboot = %d\ntype = %d\nmode = %d\nmemory = %s\npa1 = %08lx\npv1 = %08lx\npa2 = %08lx\npv2 = %08lx\n",
text, GUI_TextEntryGetText(self.device), GUI_WidgetGetState(self.dma), async,
GUI_WidgetGetState(self.cdda), GUI_WidgetGetState(self.fastboot), type, mode, memory, self.pa[0], self.pv[0], self.pa[1], self.pv[1]);

fs_write(fd, result, /*sizeof*/strlen(result));
Expand All @@ -1351,7 +1351,8 @@ int isoLoader_LoadPreset() {
int fastboot = 0;
int boot_mode = BOOT_MODE_DIRECT;
int bin_type = BIN_TYPE_AUTO;
char *title = NULL;
char title[32];
char device[4];
char memory[12] = "0x8c004000";
char patchtxt[4][10];
int i;
Expand All @@ -1367,7 +1368,8 @@ int isoLoader_LoadPreset() {
{ "async", CONF_INT, (void *) &emu_async },
{ "mode", CONF_INT, (void *) &boot_mode },
{ "type", CONF_INT, (void *) &bin_type },
{ "title", CONF_STR, (void *) title },
{ "title", CONF_STR, (void *) &title },
{ "device", CONF_STR, (void *) &device },
{ "fastboot", CONF_INT, (void *) &fastboot },
{ "pa1", CONF_STR, (void *) patchtxt[0] },
{ "pv1", CONF_STR, (void *) patchtxt[1] },
Expand Down Expand Up @@ -1406,10 +1408,10 @@ int isoLoader_LoadPreset() {
GUI_WidgetSetState(self.boot_mode_chk[boot_mode], 1);
isoLoader_toggleBootMode(self.boot_mode_chk[boot_mode]);

if(title) {
GUI_LabelSetText(self.title, title);
vmu_draw_string(title);
}
GUI_LabelSetText(self.title, title);
vmu_draw_string(title);

GUI_TextEntrySetText(self.device, device);

for(i = 0; self.memory_chk[i]; i++) {

Expand Down