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

Code refactor and bug fixes related to bgm. #1444

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .clang-format-ignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
./modules/isofs/lz4.c
./modules/isofs/lz4.h
./modules/network/lwNBD
./thirdparty/clang-format-lint-action
./thirdparty/clang-format-lint-action
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ ifneq ($(GIT_TAG),latest)
endif
endif

FRONTEND_OBJS = pad.o xparam.o fntsys.o renderman.o menusys.o OSDHistory.o system.o lang.o lang_internal.o config.o hdd.o dialogs.o \
FRONTEND_OBJS = audio.o pad.o xparam.o fntsys.o renderman.o submenu.o menu.o OSDHistory.o system.o lang.o lang_internal.o config.o hdd.o dialogs.o \
dia.o ioman.o texcache.o themes.o supportbase.o bdmsupport.o ethsupport.o hddsupport.o zso.o lz4.o \
appsupport.o gui.o guigame.o textures.o opl.o atlas.o nbns.o httpclient.o gsm.o cheatman.o sound.o ps2cnf.o

Expand Down
26 changes: 0 additions & 26 deletions include/appsupport.h
Original file line number Diff line number Diff line change
@@ -1,32 +1,6 @@
#ifndef __APP_SUPPORT_H
#define __APP_SUPPORT_H

#include "include/iosupport.h"

#define APP_MODE_UPDATE_DELAY 240

#define APP_TITLE_MAX 128
#define APP_PATH_MAX 128
#define APP_BOOT_MAX 64
#define APP_ARGV1_MAX 128

#define APP_CONFIG_TITLE "title"
#define APP_CONFIG_BOOT "boot"
#define APP_CONFIG_ARGV1 "argv1"

#define APP_TITLE_CONFIG_FILE "title.cfg"

typedef struct
{
char title[APP_TITLE_MAX + 1];
char path[APP_PATH_MAX + 1];
char boot[APP_BOOT_MAX + 1];
char argv1[APP_ARGV1_MAX + 1];
u8 legacy;
} app_info_t;

void appInit();
item_list_t *appGetObject(int initOnly);
void appPostUpdateCallback(int mode);

#endif
9 changes: 9 additions & 0 deletions include/audio.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef __AUDIO_H
#define __AUDIO_H

void audioInit(void);
void audioEnd(void);
void audioSetVolume();
void audioSetSfxVolume(int sfx);

#endif
26 changes: 2 additions & 24 deletions include/bdmsupport.h
Original file line number Diff line number Diff line change
@@ -1,28 +1,6 @@
#ifndef __BDM_SUPPORT_H
#define __BDM_SUPPORT_H

#include "include/iosupport.h"

#define BDM_MODE_UPDATE_DELAY MENU_UPD_DELAY_GENREFRESH

#include "include/mcemu.h"

typedef struct
{
int active; /* Activation flag */
u64 start_sector; /* Start sector of vmc file */
int flags; /* Card flag */
vmc_spec_t specs; /* Card specifications */
} bdm_vmc_infos_t;

#define MAX_BDM_DEVICES 5

#define BDM_TYPE_UNKNOWN -1
#define BDM_TYPE_USB 0
#define BDM_TYPE_ILINK 1
#define BDM_TYPE_SDC 2
#define BDM_TYPE_ATA 3

typedef struct
{
int massDeviceIndex; // Underlying device index backing the mass fs partition, ex: usb0 = 0, usb1 = 1, etc.
Expand All @@ -42,10 +20,10 @@ typedef struct
unsigned char ForceRefresh;
} bdm_device_data_t;

void bdmInit();
extern bdm_device_data_t *gAutoLaunchDeviceData;

int bdmFindPartition(char *target, const char *name, int write);
void bdmLoadModules(void);
void bdmLaunchGame(item_list_t *itemList, int id, config_set_t *configSet);

void bdmInitSemaphore();
void bdmEnumerateDevices();
Expand Down
11 changes: 1 addition & 10 deletions include/cheatman.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,6 @@
#ifndef _CHEATMAN_H_
#define _CHEATMAN_H_

#include "opl.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <fcntl.h>
#include <malloc.h>
#include <ctype.h>
#include <string.h>

#define CHEAT_VERSION "0.5.3.7"

#define MAX_HOOKS 5
Expand Down Expand Up @@ -71,7 +62,7 @@ extern cheat_entry_t gCheats[MAX_CODES];

void InitCheatsConfig(config_set_t *configSet);
int GetCheatsEnabled(void);
const u32 *GetCheatsList(void);
u32 *GetCheatsList(void);
int load_cheats(const char *cheatfile);
void set_cheats_list(void);

Expand Down
6 changes: 5 additions & 1 deletion include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ int configSetColor(config_set_t *configSet, const char *key, unsigned char *colo
int configGetColor(config_set_t *configSet, const char *key, unsigned char *color);
int configRemoveKey(config_set_t *configSet, const char *key);
void configMerge(config_set_t *dest, const config_set_t *source);

void configGetDiscIDBinary(config_set_t *configSet, void *dst);

int configRead(config_set_t *configSet);
Expand All @@ -183,4 +182,9 @@ void configRemoveVMC(config_set_t *configSet, int slot);
char *configGetDir(void);
void configPrepareNotifications(char *prefix);

int configCheckBDM(int types);
int configCheckHDD(int types);

int configCheckMC(int types);

#endif
2 changes: 0 additions & 2 deletions include/dia.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef __DIA_H
#define __DIA_H

#include "include/opl.h"

// UI dialog item definition
typedef enum {
// terminates the definition of dialog. Mandatory
Expand Down
11 changes: 3 additions & 8 deletions include/ethsupport.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#ifndef __ETH_SUPPORT_H
#define __ETH_SUPPORT_H

#include "include/iosupport.h"

#define ETH_MODE_UPDATE_DELAY 300

#include "include/mcemu.h"
typedef struct
{
int active; /* Activation flag */
Expand All @@ -15,13 +12,11 @@ typedef struct
vmc_spec_t specs; /* Card specifications */
} smb_vmc_infos_t;

void ethInit(item_list_t *itemList); // Full initialization (Start ETH + SMB and apply configuration). GUI must be already initialized, used by GUI to start SMB mode.
void ethDeinitModules(void); // Module-only deinitialization, without the GUI's knowledge (for specific reasons, otherwise unused).
int ethLoadInitModules(void); // Initializes Ethernet and applies configuration.
void ethDisplayErrorStatus(void); // Displays the current error status (if any). GUI must be already initialized.
void ethDeinitModules(void); // Module-only deinitialization, without the GUI's knowledge (for specific reasons, otherwise unused).
int ethLoadInitModules(void); // Initializes Ethernet and applies configuration.
void ethDisplayErrorStatus(void); // Displays the current error status (if any). GUI must be already initialized.
int ethGetNetConfig(u8 *ip_address, u8 *netmask, u8 *gateway);
int ethApplyConfig(void);
int ethGetDHCPStatus(void);
item_list_t *ethGetObject(int initOnly);

#endif
6 changes: 0 additions & 6 deletions include/gui.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#ifndef __GUI_H
#define __GUI_H

#include "include/iosupport.h"
#include "include/opl.h"
#include "include/texcache.h"
#include "include/dialogs.h"
#include "include/menusys.h"

typedef enum {
// Informs gui that init is over and main gui can be rendered
GUI_INIT_DONE = 1,
Expand Down
98 changes: 35 additions & 63 deletions include/hdd.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
#ifndef __HDD_H
#define __HDD_H

#include <hdd-ioctl.h>

#define HDL_GAME_NAME_MAX 64

// APA Partition
#define APA_IOCTL2_GETHEADER 0x6836

typedef struct
{
u32 start; // Sector address
Expand All @@ -9,49 +16,24 @@ typedef struct

typedef struct
{
u8 unused;
u8 sec;
u8 min;
u8 hour;
u8 day;
u8 month;
u16 year;
} ps2time_t;
char partition_name[APA_IDMAX + 1];
char name[HDL_GAME_NAME_MAX + 1];
char startup[8 + 1 + 3 + 1];
u8 hdl_compat_flags;
u8 ops2l_compat_flags;
u8 dma_type;
u8 dma_mode;
u8 disctype;
u32 layer_break;
u32 start_sector;
u32 total_size_in_kb;
} hdl_game_info_t;

typedef struct
{
u32 checksum;
u32 magic; // APA_MAGIC
u32 next;
u32 prev;
char id[APA_IDMAX];
char rpwd[APA_PASSMAX];
char fpwd[APA_PASSMAX];
u32 start;
u32 length;
u16 type;
u16 flags;
u32 nsub;
ps2time_t created;
u32 main;
u32 number;
u32 modver;
u32 pading1[7];
char pading2[128];
struct
{
char magic[32];
u32 version;
u32 nsector;
ps2time_t created;
u32 osdStart;
u32 osdSize;
char pading3[200];
} mbr;
apa_sub_t subs[APA_MAXSUB];
} apa_header_t;

#define PFS_INODE_MAX_BLOCKS 114
u32 count;
hdl_game_info_t *games;
} hdl_games_list_t;

typedef struct
{
Expand All @@ -60,29 +42,7 @@ typedef struct
u16 count;
} pfs_blockinfo_t;

typedef struct
{
u32 checksum;
u32 magic;
pfs_blockinfo_t inode_block;
pfs_blockinfo_t next_segment;
pfs_blockinfo_t last_segment;
pfs_blockinfo_t unused;
pfs_blockinfo_t data[PFS_INODE_MAX_BLOCKS];
u16 mode;
u16 attr;
u16 uid;
u16 gid;
ps2time_t atime;
ps2time_t ctime;
ps2time_t mtime;
u64 size;
u32 number_blocks;
u32 number_data;
u32 number_segdesg;
u32 subpart;
u32 reserved[4];
} pfs_inode_t;
extern hdl_game_info_t *gAutoLaunchGame;

int hddReadSectors(u32 lba, u32 nsectors, void *buf);

Expand All @@ -92,4 +52,16 @@ int hddGetPartitionInfo(const char *name, apa_sub_t *parts);
// Array should be max entries.
int hddGetFileBlockInfo(const char *name, const apa_sub_t *subs, pfs_blockinfo_t *blocks, int max);

int hddCheck(void);
u32 hddGetTotalSectors(void);
int hddIs48bit(void);
int hddSetTransferMode(int type, int mode);
void hddSetIdleTimeout(int timeout);
void hddSetIdleImmediate(void);
int hddGetHDLGamelist(hdl_games_list_t *game_list);
void hddFreeHDLGamelist(hdl_games_list_t *game_list);
int hddSetHDLGameInfo(hdl_game_info_t *ginfo);
int hddDeleteHDLGame(hdl_game_info_t *ginfo);


#endif
43 changes: 0 additions & 43 deletions include/hddsupport.h
Original file line number Diff line number Diff line change
@@ -1,44 +1,12 @@
#ifndef __HDD_SUPPORT_H
#define __HDD_SUPPORT_H

#include "include/iosupport.h"
#include "include/hdd.h"

#define HDD_MODE_UPDATE_DELAY MENU_UPD_DELAY_NOUPDATE

#define HDL_GAME_NAME_MAX 64

// APA Partition
#define APA_IOCTL2_GETHEADER 0x6836

typedef struct
{
char partition_name[APA_IDMAX + 1];
char name[HDL_GAME_NAME_MAX + 1];
char startup[8 + 1 + 3 + 1];
u8 hdl_compat_flags;
u8 ops2l_compat_flags;
u8 dma_type;
u8 dma_mode;
u8 disctype;
u32 layer_break;
u32 start_sector;
u32 total_size_in_kb;
} hdl_game_info_t;

typedef struct
{
u32 count;
hdl_game_info_t *games;
} hdl_games_list_t;

typedef struct
{
u32 start;
u32 length;
} apa_subs;

#include "include/mcemu.h"
typedef struct
{
int active; /* Activation flag */
Expand All @@ -48,17 +16,6 @@ typedef struct
vmc_spec_t specs; /* Card specifications */
} hdd_vmc_infos_t;

int hddCheck(void);
u32 hddGetTotalSectors(void);
int hddIs48bit(void);
int hddSetTransferMode(int type, int mode);
void hddSetIdleTimeout(int timeout);
void hddSetIdleImmediate(void);
int hddGetHDLGamelist(hdl_games_list_t *game_list);
void hddFreeHDLGamelist(hdl_games_list_t *game_list);
int hddSetHDLGameInfo(hdl_game_info_t *ginfo);
int hddDeleteHDLGame(hdl_game_info_t *ginfo);

void hddInit();
item_list_t *hddGetObject(int initOnly);
void hddLoadModules(void);
Expand Down
Loading
Loading