Revert "lwnbd: improve opl integration"

pull/919/head
AKuHAK 2023-04-12 10:12:10 +03:00 committed by GitHub
parent a88fbd03a6
commit 4b182d0b9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 122 additions and 144 deletions

View File

@ -65,8 +65,7 @@ endif
FRONTEND_OBJS = pad.o fntsys.o renderman.o menusys.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 lwnbdsupport.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
IOP_OBJS = iomanx.o filexio.o ps2fs.o usbd.o bdmevent.o \
bdm.o bdmfs_fatfs.o usbmass_bd.o iLinkman.o IEEE1394_bd.o mx4sio_bd.o \

View File

@ -3,7 +3,7 @@
## Download lwNBD
REPO_URL="https://github.com/bignaux/lwNBD.git"
REPO_FOLDER="modules/network/lwNBD"
COMMIT="0fed27b81afb8e7619d000599b17a8c272b14dd5"
COMMIT="9777a10f840679ef89b1ec6a588e2d93803d7c37"
if test ! -d "$REPO_FOLDER"; then
git clone $REPO_URL "$REPO_FOLDER" || { exit 1; }
(cd $REPO_FOLDER && git checkout "$COMMIT" && cd -) || { exit 1; }

View File

@ -44,6 +44,8 @@ IMPORT_BIN2C(hdd_cdvdman_irx);
IMPORT_BIN2C(hdd_hdpro_cdvdman_irx);
IMPORT_BIN2C(lwnbdsvr_irx);
IMPORT_BIN2C(hdd_mcemu_irx);
IMPORT_BIN2C(hdpro_atad_irx);
@ -68,8 +70,6 @@ IMPORT_BIN2C(iremsndpatch_irx);
IMPORT_BIN2C(libsd_irx);
IMPORT_BIN2C(lwnbdsvr_irx);
IMPORT_BIN2C(mcman_irx);
IMPORT_BIN2C(mcserv_irx);

View File

@ -1,21 +0,0 @@
#ifndef INCLUDE_LWNBDSUPPORT_H_
#define INCLUDE_LWNBDSUPPORT_H_
#define LWNBD_SID 0x2A39;
enum LWNBD_SERVER_CMD {
LWNBD_SERVER_CMD_START,
LWNBD_SERVER_CMD_STOP,
};
struct lwnbd_config
{
char defaultexport[32];
uint8_t readonly;
};
void handleLwnbdSrv();
int NBDInit(void);
void NBDDeinit(void);
#endif /* INCLUDE_LWNBDSUPPORT_H_ */

View File

@ -76,6 +76,7 @@ int saveConfig(int types, int showUI);
void applyConfig(int themeID, int langID);
void menuDeferredUpdate(void *data);
void moduleUpdateMenu(int mode, int themeChanged, int langChanged);
void handleLwnbdSrv();
void deinit(int exception, int modeSelected);
// Shutdown minimal services initiated for auto loading.

View File

@ -18,7 +18,6 @@
#include "include/nbns.h"
#include "httpclient.h"
#include "include/lwnbdsupport.h"
static char ethPrefix[40]; // Contains the full path to the folder where all the games are.
static char *ethBase;
@ -292,10 +291,8 @@ static int ethLoadModules(void)
if (sysLoadModuleBuffer(&ps2ip_irx, size_ps2ip_irx, 0, NULL) >= 0) {
sysLoadModuleBuffer(&ps2ips_irx, size_ps2ips_irx, 0, NULL);
sysLoadModuleBuffer(&httpclient_irx, size_httpclient_irx, 0, NULL);
sysLoadModuleBuffer(&lwnbdsvr_irx, size_lwnbdsvr_irx, 0, NULL);
ps2ip_init();
HttpInit();
NBDInit();
LOG("ETHSUPPORT Modules loaded\n");
return 0;
@ -319,7 +316,6 @@ void ethDeinitModules(void)
HttpDeinit();
nbnsDeinit();
NetManDeinit();
NBDDeinit();
ethModulesLoaded = 0;
gNetworkStartup = ERROR_ETH_NOT_STARTED;

View File

@ -1,104 +0,0 @@
// this need to be on top since some include miss including some headers
#include "include/opl.h"
#include "include/config.h"
#include "include/ethsupport.h"
#include "include/extern_irx.h"
#include "include/gui.h" // guiExecDeferredOps
#include "include/hddsupport.h"
#include "include/ioman.h" // ioBlockOps
#include "include/lang.h"
#include "include/lwnbdsupport.h"
#include "include/sound.h"
#include "include/system.h"
static SifRpcClientData_t SifRpcClient;
int NBDInit(void)
{
int sid = LWNBD_SID;
while (SifBindRpc(&SifRpcClient, sid, 0) < 0 || SifRpcClient.server == NULL) {
nopdelay();
}
return 0;
}
void NBDDeinit(void)
{
memset(&SifRpcClient, 0, sizeof(SifRpcClientData_t));
}
static int loadLwnbdSvr(void)
{
int ret;
struct lwnbd_config
{
char defaultexport[32];
uint8_t readonly;
};
struct lwnbd_config config;
char gExportName[32];
config_set_t *configNet = configGetByType(CONFIG_NETWORK);
configGetStrCopy(configNet, CONFIG_NET_NBD_DEFAULT_EXPORT, gExportName, sizeof(gExportName));
// deint audio lib while nbd server is running
// audioEnd();
// block all io ops, wait for the ones still running to finish
// ioBlockOps(1);
// guiExecDeferredOps();
/* compat stuff for user not providing name export (useless when there was only one export) */
ret = strlen(gExportName);
if (ret == 0)
strcpy(config.defaultexport, "hdd0");
else
strcpy(config.defaultexport, gExportName);
config.readonly = !gEnableWrite;
if (gNetworkStartup != 0)
ret = ethLoadInitModules();
if (ret != 0)
return -1;
if (gHDDStartMode != 0)
hddLoadModules();
ret = SifCallRpc(&SifRpcClient, LWNBD_SERVER_CMD_START, 0, &config, sizeof(struct lwnbd_config), NULL, 0, NULL, NULL);
return ret;
}
static void unloadLwnbdSvr(void)
{
SifCallRpc(&SifRpcClient, LWNBD_SERVER_CMD_STOP, 0, NULL, 0, NULL, 0, NULL, NULL);
// now start io again
// ioBlockOps(0);
//
// audioInit();
// sfxInit(0);
// if (gEnableBGM)
// bgmStart();
}
/* call in src/menusys.c */
void handleLwnbdSrv()
{
char temp[256];
// prepare for lwnbd, display screen with info
guiRenderTextScreen(_l(_STR_STARTINGNBD));
if (loadLwnbdSvr() == 0) {
snprintf(temp, sizeof(temp), "%s", _l(_STR_RUNNINGNBD));
guiMsgBox(temp, 0, NULL);
} else
guiMsgBox(_l(_STR_STARTFAILNBD), 0, NULL);
// restore normal functionality again
guiRenderTextScreen(_l(_STR_UNLOADNBD));
unloadLwnbdSvr();
}

View File

@ -4,20 +4,19 @@
Review OpenUsbLd README & LICENSE files for further details.
*/
#include "include/opl.h"
#include "include/menusys.h"
#include "include/iosupport.h"
#include "include/renderman.h"
#include "include/fntsys.h"
#include "include/lang.h"
#include "include/themes.h"
#include "include/pad.h"
#include "include/gui.h"
#include "include/guigame.h"
#include "include/ioman.h"
#include "include/iosupport.h"
#include "include/lang.h"
#include "include/lwnbdsupport.h"
#include "include/menusys.h"
#include "include/opl.h"
#include "include/pad.h"
#include "include/renderman.h"
#include "include/sound.h"
#include "include/system.h"
#include "include/themes.h"
#include "include/ioman.h"
#include "include/sound.h"
#include <assert.h>
enum MENU_IDs {

108
src/opl.c
View File

@ -199,6 +199,7 @@ hdl_game_info_t *gAutoLaunchGame;
base_game_info_t *gAutoLaunchBDMGame;
char gOPLPart[128];
char *gHDDPrefix;
char gExportName[32];
int gOSDLanguageValue;
int gOSDLanguageEnable;
@ -922,6 +923,8 @@ static void _loadConfig()
sscanf(temp, "%d.%d.%d.%d", &ps2_gateway[0], &ps2_gateway[1], &ps2_gateway[2], &ps2_gateway[3]);
if (configGetStr(configNet, CONFIG_NET_PS2_DNS, &temp))
sscanf(temp, "%d.%d.%d.%d", &ps2_dns[0], &ps2_dns[1], &ps2_dns[2], &ps2_dns[3]);
configGetStrCopy(configNet, CONFIG_NET_NBD_DEFAULT_EXPORT, gExportName, sizeof(gExportName));
}
}
@ -1408,8 +1411,113 @@ int oplUpdateGameCompatSingle(int id, item_list_t *support, config_set_t *config
return CompatUpdateStatus;
}
// ----------------------------------------------------------
// -------------------- NBD SRV Support ---------------------
// ----------------------------------------------------------
static int loadLwnbdSvr(void)
{
int ret, padStatus;
struct lwnbd_config
{
char defaultexport[32];
uint8_t readonly;
};
struct lwnbd_config config;
// deint audio lib while nbd server is running
audioEnd();
// block all io ops, wait for the ones still running to finish
ioBlockOps(1);
guiExecDeferredOps();
// Deinitialize all support without shutting down the HDD unit.
deinitAllSupport(NO_EXCEPTION, IO_MODE_SELECTED_ALL);
clearErrorMessage(); /* At this point, an error might have been displayed (since background tasks were completed).
Clear it, otherwise it will get displayed after the server is closed. */
unloadPads();
// sysReset(0); // usefull ? printf doesn't work with it.
/* compat stuff for user not providing name export (useless when there was only one export) */
ret = strlen(gExportName);
if (ret == 0)
strcpy(config.defaultexport, "hdd0");
else
strcpy(config.defaultexport, gExportName);
config.readonly = !gEnableWrite;
// see gETHStartMode, gNetworkStartup ? this is slow, so if we don't have to do it (like debug build).
ret = ethLoadInitModules();
if (ret == 0) {
ret = sysLoadModuleBuffer(&ps2atad_irx, size_ps2atad_irx, 0, NULL); /* gHDDStartMode ? */
if (ret >= 0) {
ret = sysLoadModuleBuffer(&lwnbdsvr_irx, size_lwnbdsvr_irx, sizeof(config), (char *)&config);
if (ret >= 0)
ret = 0;
}
}
padInit(0);
// init all pads
padStatus = 0;
while (!padStatus)
padStatus = startPads();
// now ready to display some status
return ret;
}
static void unloadLwnbdSvr(void)
{
ethDeinitModules();
unloadPads();
reset();
LOG_INIT();
LOG_ENABLE();
// reinit the input pads
padInit(0);
int ret = 0;
while (!ret)
ret = startPads();
// now start io again
ioBlockOps(0);
// init all supports again
initAllSupport(1);
audioInit();
sfxInit(0);
if (gEnableBGM)
bgmStart();
}
void handleLwnbdSrv()
{
char temp[256];
// prepare for lwnbd, display screen with info
guiRenderTextScreen(_l(_STR_STARTINGNBD));
if (loadLwnbdSvr() == 0) {
snprintf(temp, sizeof(temp), "%s", _l(_STR_RUNNINGNBD));
guiMsgBox(temp, 0, NULL);
} else
guiMsgBox(_l(_STR_STARTFAILNBD), 0, NULL);
// restore normal functionality again
guiRenderTextScreen(_l(_STR_UNLOADNBD));
unloadLwnbdSvr();
}
// ----------------------------------------------------------
// --------------------- Init/Deinit ------------------------
// ----------------------------------------------------------