Skip to content

Commit

Permalink
Updated CEX DECI2 support to also work in the UI, also to get it work…
Browse files Browse the repository at this point in the history
…ing again due to changes in commit b679d5f (requires network to be initialized), changed settings used by SMSTCPIP for ingame debugging (non-ingame mode).
  • Loading branch information
sp193 committed Jan 11, 2019
1 parent 31cbb6d commit 1f16be7
Show file tree
Hide file tree
Showing 13 changed files with 109 additions and 16 deletions.
20 changes: 17 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ endif

ifeq ($(DEBUG),1)
EE_CFLAGS += -D__DEBUG -g
EE_OBJS += debug.o udptty.o ioptrap.o ps2link.o
ifeq ($(DECI2_DEBUG),1)
EE_OBJS += debug.o drvtif_irx.o tifinet_irx.o deci2_img.o
EE_LDFLAGS += -liopreboot
else
EE_OBJS += debug.o udptty.o ioptrap.o ps2link.o
endif
MOD_DEBUG_FLAGS = DEBUG=1
ifeq ($(IOPCORE_DEBUG),1)
EE_CFLAGS += -D__INGAME_DEBUG
Expand All @@ -158,9 +163,9 @@ ifeq ($(DEBUG),1)
ifeq ($(DECI2_DEBUG),1)
EE_CFLAGS += -D__DECI2_DEBUG
EECORE_EXTRA_FLAGS += DECI2_DEBUG=1
IOP_OBJS += drvtif_irx.o tifinet_irx.o
IOP_OBJS += drvtif_ingame_irx.o tifinet_ingame_irx.o
DECI2_DEBUG=1
CDVDMAN_DEBUG_FLAGS = USE_DEV9=1 #dsidb cannot be used to handle exceptions or set breakpoints, so disable output to save resources.
CDVDMAN_DEBUG_FLAGS = USE_DEV9=1 #(clear IOPCORE_DEBUG) dsidb cannot be used to handle exceptions or set breakpoints, so disable output to save resources.
else
IOP_OBJS += udptty-ingame.o
endif
Expand Down Expand Up @@ -749,12 +754,21 @@ $(EE_ASM_DIR)transition.s: misc/transition.adp | $(EE_ASM_DIR)
$(EE_ASM_DIR)IOPRP_img.s: modules/iopcore/IOPRP.img | $(EE_ASM_DIR)
$(BIN2S) $< $@ IOPRP_img

$(EE_ASM_DIR)drvtif_ingame_irx.s: modules/debug/drvtif-ingame.irx | $(EE_ASM_DIR)
$(BIN2S) $< $@ drvtif_ingame_irx

$(EE_ASM_DIR)tifinet_ingame_irx.s: modules/debug/tifinet-ingame.irx | $(EE_ASM_DIR)
$(BIN2S) $< $@ tifinet_ingame_irx

$(EE_ASM_DIR)drvtif_irx.s: modules/debug/drvtif.irx | $(EE_ASM_DIR)
$(BIN2S) $< $@ drvtif_irx

$(EE_ASM_DIR)tifinet_irx.s: modules/debug/tifinet.irx | $(EE_ASM_DIR)
$(BIN2S) $< $@ tifinet_irx

$(EE_ASM_DIR)deci2_img.s: modules/debug/deci2.img | $(EE_ASM_DIR)
$(BIN2S) $< $@ deci2_img

$(EE_OBJS_DIR)%.o: $(EE_SRC_DIR)%.c | $(EE_OBJS_DIR)
$(EE_CC) $(EE_CFLAGS) $(EE_INCS) -c $< -o $@

Expand Down
1 change: 1 addition & 0 deletions include/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
#define __DEBUG_H

int debugSetActive(void);
void debugApplyConfig(void);

#endif
5 changes: 1 addition & 4 deletions include/ethsupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ void ethDeinitModules(void); //Module-only deinitialization, without the GU
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 ethWaitValidNetIFLinkState(void);
int ethWaitValidDHCPState(void);
int ethApplyNetIFConfig(void);
int ethApplyIPConfig(void);
int ethApplyConfig(void);
int ethGetDHCPStatus(void);
item_list_t *ethGetObject(int initOnly);

Expand Down
9 changes: 9 additions & 0 deletions include/extern_irx.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,15 @@ extern int size_bt_pademu_irx;
extern void *cdvdfsv_irx;
extern int size_cdvdfsv_irx;

extern void *deci2_img;
extern int size_deci2_img;

extern void *drvtif_irx;
extern int size_drvtif_irx;

extern void *drvtif_ingame_irx;
extern int size_drvtif_ingame_irx;

extern void *ds34bt_irx;
extern int size_ds34bt_irx;

Expand Down Expand Up @@ -139,6 +145,9 @@ extern int size_smsutils_irx;
extern void *tifinet_irx;
extern int size_tifinet_irx;

extern void *tifinet_ingame_irx;
extern int size_tifinet_ingame_irx;

extern void *udptty_irx;
extern int size_udptty_irx;

Expand Down
3 changes: 3 additions & 0 deletions include/system.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ void sysShutdownDev9(void);
void sysReset(int modload_mask);
void sysExecExit();
void sysPowerOff(void);
#ifdef __DECI2_DEBUG
int sysInitDECI2(void);
#endif

void sysLaunchLoaderElf(char *filename, char *mode_str, int size_cdvdman_irx, void **cdvdman_irx, int size_mcemu_irx, void **mcemu_irx, int EnablePS2Logo, unsigned int compatflags);

Expand Down
Binary file added modules/debug/deci2.img
Binary file not shown.
Binary file added modules/debug/drvtif-ingame.irx
Binary file not shown.
Binary file added modules/debug/tifinet-ingame.irx
Binary file not shown.
Binary file modified modules/debug/tifinet.irx
Binary file not shown.
22 changes: 22 additions & 0 deletions src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "include/ioman.h"
#include "include/extern_irx.h"

static u8 modulesLoaded = 0;

int debugSetActive(void)
{
Expand All @@ -19,6 +20,15 @@ int debugSetActive(void)
if ((ret = ethLoadInitModules()) != 0)
return -1;

#ifdef __DECI2_DEBUG
ret = sysLoadModuleBuffer(&drvtif_irx, size_drvtif_irx, 0, NULL);
if (ret < 0)
return -8;

ret = sysLoadModuleBuffer(&tifinet_irx, size_tifinet_irx, 0, NULL);
if (ret < 0)
return -9;
#else
ret = sysLoadModuleBuffer(&udptty_irx, size_udptty_irx, 0, NULL);
if (ret < 0)
return -8;
Expand All @@ -31,6 +41,18 @@ int debugSetActive(void)
if (ret < 0)
return -10;
#endif
#endif

modulesLoaded = 1;

return 0;
}

void debugApplyConfig(void)
{
#ifndef _DTL_T10000
if (modulesLoaded)
ethApplyConfig();
#endif
}

25 changes: 20 additions & 5 deletions src/ethsupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ static struct ip4_addr lastGW;

// forward declaration
static item_list_t ethGameList;
static int ethReadNetConfig(void);
static int ethWaitValidNetIFLinkState(void);
static int ethWaitValidDHCPState(void);
static int ethGetNetIFLinkStatus(void);
static int ethApplyNetIFConfig(void);
static int ethApplyIPConfig(void);
static int ethReadNetConfig(void);

static int ethInitSemaID = -1;

Expand Down Expand Up @@ -183,12 +187,12 @@ static int WaitValidNetState(int (*checkingFunction)(void))
return 0;
}

int ethWaitValidNetIFLinkState(void)
static int ethWaitValidNetIFLinkState(void)
{
return WaitValidNetState(&ethGetNetIFLinkStatus);
}

int ethWaitValidDHCPState(void)
static int ethWaitValidDHCPState(void)
{
return WaitValidNetState(&ethGetDHCPStatus);
}
Expand Down Expand Up @@ -221,6 +225,17 @@ static int ethInitApplyConfig(void)
return 0;
}

int ethApplyConfig(void)
{
int ret;

WaitSema(ethInitSemaID);
ret = ethInitApplyConfig();
SignalSema(ethInitSemaID);

return ret;
}

static void ethInitSMB(void)
{
int ret;
Expand Down Expand Up @@ -793,7 +808,7 @@ int ethGetNetConfig(u8 *ip_address, u8 *netmask, u8 *gateway)
return result;
}

int ethApplyNetIFConfig(void)
static int ethApplyNetIFConfig(void)
{
int mode, result;
static int CurrentMode = NETMAN_NETIF_ETH_LINK_MODE_AUTO;
Expand Down Expand Up @@ -829,7 +844,7 @@ static int ethGetNetIFLinkStatus(void)
return (NetManIoctl(NETMAN_NETIF_IOCTL_GET_LINK_STATUS, NULL, 0, NULL, 0) == NETMAN_NETIF_ETH_LINK_STATE_UP);
}

int ethApplyIPConfig(void)
static int ethApplyIPConfig(void)
{
t_ip_info ip_info;
struct ip4_addr ipaddr, netmask, gw, dns;
Expand Down
8 changes: 8 additions & 0 deletions src/opl.c
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,10 @@ void applyConfig(int themeID, int langID)
moduleUpdateMenu(ETH_MODE, changed);
moduleUpdateMenu(HDD_MODE, changed);
moduleUpdateMenu(APP_MODE, changed);

#ifdef __DEBUG
debugApplyConfig();
#endif
}

int loadConfig(int types)
Expand Down Expand Up @@ -1434,6 +1438,10 @@ static void deferredAudioInit(void)
// --------------------- Main --------------------
int main(int argc, char *argv[])
{
#ifdef __DECI2_DEBUG
sysInitDECI2();
#endif

LOG_INIT();
PREINIT_LOG("OPL GUI start!\n");

Expand Down
32 changes: 28 additions & 4 deletions src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
Review OpenUsbLd README & LICENSE files for further details.
*/

#ifdef __DECI2_DEBUG
#include <iopcontrol_special.h>
#endif

#include "include/opl.h"
#include "include/gui.h"
#include "include/ethsupport.h"
Expand Down Expand Up @@ -171,9 +175,14 @@ void sysReset(int modload_mask)
#ifdef _DTL_T10000
while (!SifIopReset("rom0:UDNL", 0))
;
#else
#ifdef __DECI2_DEBUG
while (!SifIopRebootBuffer(&deci2_img, size_deci2_img))
;
#else
while (!SifIopReset("", 0))
;
#endif
#endif

dev9Initialized = 0;
Expand Down Expand Up @@ -491,10 +500,10 @@ static unsigned int sendIrxKernelRAM(const char *startup, const char *mode_str,
#ifdef __INGAME_DEBUG
#ifdef __DECI2_DEBUG
if (modules & CORE_IRX_DECI2) {
irxptr_tab[modcount].info = size_drvtif_irx | SET_OPL_MOD_ID(OPL_MODULE_ID_DRVTIF);
irxptr_tab[modcount++].ptr = (void *)&drvtif_irx;
irxptr_tab[modcount].info = size_tifinet_irx | SET_OPL_MOD_ID(OPL_MODULE_ID_TIFINET);
irxptr_tab[modcount++].ptr = (void *)&tifinet_irx;
irxptr_tab[modcount].info = size_drvtif_ingame_irx | SET_OPL_MOD_ID(OPL_MODULE_ID_DRVTIF);
irxptr_tab[modcount++].ptr = (void *)&drvtif_ingame_irx;
irxptr_tab[modcount].info = size_tifinet_ingame_irx | SET_OPL_MOD_ID(OPL_MODULE_ID_TIFINET);
irxptr_tab[modcount++].ptr = (void *)&tifinet_ingame_irx;
}
#else
if (modules & CORE_IRX_DEBUG) {
Expand Down Expand Up @@ -593,6 +602,21 @@ static int ResetDECI2(void)

return result;
}

int sysInitDECI2(void)
{
int result;

DI();
ee_kmode_enter();

result = ResetDECI2();

ee_kmode_exit();
EI();

return result;
}
#endif

/* Returns the patch location of LoadExecPS2(), which resides in kernel memory.
Expand Down

0 comments on commit 1f16be7

Please sign in to comment.