Skip to content

Commit 18ad228

Browse files
committed
move init & some IOP ops to different source file
1 parent d2e81fa commit 18ad228

7 files changed

Lines changed: 394 additions & 283 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"name": "PS2SDK (ghcr)",
3+
"image": "ghcr.io/ps2homebrew/ps2homebrew:main",
4+
"workspaceFolder": "/project",
5+
"workspaceMount": "source=${localWorkspaceFolder},target=/project,type=bind",
6+
7+
"customizations": {
8+
"vscode": {
9+
"settings": {
10+
"C_Cpp.intelliSenseEngine": "default",
11+
"C_Cpp.default.configurationProvider": "ms-vscode.makefile-tools",
12+
"C_Cpp.default.includePath": [
13+
"/project",
14+
"/usr/local/ps2dev/ps2sdk/common/include",
15+
"/usr/local/ps2dev/ps2sdk/ee/include",
16+
"/usr/local/ps2dev/ps2sdk/iop/include"
17+
]
18+
},
19+
"extensions": [
20+
"ms-vscode.cpptools",
21+
"ms-vscode.makefile-tools"
22+
]
23+
}
24+
},
25+
26+
"remoteUser": "root"
27+
}

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ EE_SRC_DIR = src/
5757
EE_ASM_DIR = asm/
5858

5959
EE_OBJS = main.o \
60-
util.o elf.o timer.o ps2.o ps1.o dvdplayer.o \
60+
init.o util.o elf.o timer.o ps2.o ps1.o dvdplayer.o \
6161
modelname.o libcdvd_add.o OSDHistory.o OSDInit.o OSDConfig.o \
6262
$(EMBEDDED_STUFF) \
6363
$(IOP_OBJS)

include/common.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#ifndef COMMONDEF
22
#define COMMONDEF
3+
/// common definitions that should not be used outside of main.c
4+
5+
#include "banner.h"
6+
37
enum
48
{
59
SOURCE_MC0 = 0,
@@ -142,6 +146,16 @@ char *DEFPATH[] = {
142146
"mc?:/APPS/ULE.ELF",
143147
};
144148

149+
typedef struct
150+
{
151+
int SKIPLOGO;
152+
char *KEYPATHS[17][3];
153+
int DELAY;
154+
int OSDHISTORY_READ;
155+
int TRAYEJECT;
156+
int LOGO_DISP; //0: NO, 1: Only Console info, any other value: YES
157+
} CONFIG;
158+
145159
#ifndef COMMIT_HASH
146160
#define COMMIT_HASH "UNKNOWn"
147161
#endif

include/init.h

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#ifndef INIT_H
2+
#define INIT_H
3+
4+
#ifdef UDPTTY
5+
extern inline void udptty_start();
6+
#define UDPTTY_STARTUP() udptty_start()
7+
#else
8+
#define UDPTTY_STARTUP()
9+
#endif
10+
11+
#ifdef FILEXIO
12+
extern inline void load_filexio();
13+
#define FILEXIO_STARTUP() load_filexio()
14+
#else
15+
#define FILEXIO_STARTUP()
16+
#endif
17+
18+
extern inline void bdm_usb();
19+
#define BDM_USB_STARTUP() bdm_usb()
20+
#define SIO2_MC_PAD_STARTUP() iop_init_sio2_related()
21+
// general init stuff
22+
23+
void init_osd_generic();
24+
void init_iop_patches();
25+
void CDVDBootCertify(u8 romver[16]);
26+
void InitPSX();
27+
28+
// IOP Related stuff
29+
30+
int LoadUSBIRX(void);
31+
void iop_init_sio2_related();
32+
#define BGR_BLUE 0xFF0000
33+
#define BGR_GREEN 0x00FF00
34+
#define BGR_RED 0x0000FF
35+
#endif

include/main.h

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include "debugprintf.h"
3131
#include "pad.h"
3232
#include "util.h"
33-
#include "common.h"
3433

3534
#include "libcdvd_add.h"
3635
#include "dvdplayer.h"
@@ -40,8 +39,13 @@
4039
#include "ps1.h"
4140
#include "ps2.h"
4241
#include "modelname.h"
43-
#include "banner.h"
42+
#include "init.h"
4443

44+
#ifdef DEBUG
45+
#define DG(x...) x// DEBUG GUARD, a little macro to isolate code that should be included only if debug enabled
46+
#else
47+
#define DG(x...)// DEBUG GUARD, a little macro to isolate code that should be included only if debug enabled
48+
#endif
4549
#ifdef PSX
4650
#include <iopcontrol_special.h>
4751
#include "psx/plibcdvd_add.h"
@@ -86,13 +90,17 @@ static void InitPSX();
8690
/// @note only supported by DRAGON Mechacons. function will do nothing on older mechacon
8791
void PrintTemperature();
8892
#endif
93+
8994
#ifdef HDD
9095
int LoadHDDIRX(void); // Load HDD IRXes
91-
int LoadFIO(void); // Load FileXio and it´s dependencies
9296
int MountParty(const char *path); ///processes strings in the format `hdd0:/$PARTITION:pfs:$PATH_TO_FILE/` to mount partition
9397
int mnt(const char *path); ///mount partition specified on path
9498
#endif
9599

100+
#ifdef FILEXIO
101+
int LoadIOX(void); // Load FileXio and it´s dependencies
102+
#endif
103+
96104
#ifdef UDPTTY
97105
void loadUDPTTY();
98106
#endif
@@ -120,7 +128,9 @@ int LookForBDMDevice(void);
120128

121129
#ifdef FILEXIO
122130
#include <fileXio_rpc.h>
123-
int LoadFIO(void); // Load FileXio and it´s dependencies
131+
int LoadIOX(void); // Load FileXio and it´s dependencies
124132
#endif
125133

134+
#define GS_BGCOLOUR(x) *((volatile unsigned long int *)0x120000E0) = x
135+
126136
#endif

0 commit comments

Comments
 (0)