Skip to content

Commit 4b182d0

Browse files
authored
Revert "lwnbd: improve opl integration"
1 parent a88fbd0 commit 4b182d0

9 files changed

+121
-143
lines changed

Makefile

+1-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ endif
6565

6666
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 \
6767
dia.o ioman.o texcache.o themes.o supportbase.o bdmsupport.o ethsupport.o hddsupport.o zso.o lz4.o \
68-
appsupport.o gui.o guigame.o textures.o opl.o atlas.o nbns.o httpclient.o gsm.o cheatman.o sound.o \
69-
ps2cnf.o lwnbdsupport.o
68+
appsupport.o gui.o guigame.o textures.o opl.o atlas.o nbns.o httpclient.o gsm.o cheatman.o sound.o ps2cnf.o
7069

7170
IOP_OBJS = iomanx.o filexio.o ps2fs.o usbd.o bdmevent.o \
7271
bdm.o bdmfs_fatfs.o usbmass_bd.o iLinkman.o IEEE1394_bd.o mx4sio_bd.o \

download_lwNBD.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Download lwNBD
44
REPO_URL="https://github.com/bignaux/lwNBD.git"
55
REPO_FOLDER="modules/network/lwNBD"
6-
COMMIT="0fed27b81afb8e7619d000599b17a8c272b14dd5"
6+
COMMIT="9777a10f840679ef89b1ec6a588e2d93803d7c37"
77
if test ! -d "$REPO_FOLDER"; then
88
git clone $REPO_URL "$REPO_FOLDER" || { exit 1; }
99
(cd $REPO_FOLDER && git checkout "$COMMIT" && cd -) || { exit 1; }

include/extern_irx.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ IMPORT_BIN2C(hdd_cdvdman_irx);
4444

4545
IMPORT_BIN2C(hdd_hdpro_cdvdman_irx);
4646

47+
IMPORT_BIN2C(lwnbdsvr_irx);
48+
4749
IMPORT_BIN2C(hdd_mcemu_irx);
4850

4951
IMPORT_BIN2C(hdpro_atad_irx);
@@ -68,8 +70,6 @@ IMPORT_BIN2C(iremsndpatch_irx);
6870

6971
IMPORT_BIN2C(libsd_irx);
7072

71-
IMPORT_BIN2C(lwnbdsvr_irx);
72-
7373
IMPORT_BIN2C(mcman_irx);
7474

7575
IMPORT_BIN2C(mcserv_irx);

include/lwnbdsupport.h

-21
This file was deleted.

include/opl.h

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ int saveConfig(int types, int showUI);
7676
void applyConfig(int themeID, int langID);
7777
void menuDeferredUpdate(void *data);
7878
void moduleUpdateMenu(int mode, int themeChanged, int langChanged);
79+
void handleLwnbdSrv();
7980
void deinit(int exception, int modeSelected);
8081

8182
// Shutdown minimal services initiated for auto loading.

src/ethsupport.c

-4
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
#include "include/nbns.h"
2020
#include "httpclient.h"
21-
#include "include/lwnbdsupport.h"
2221

2322
static char ethPrefix[40]; // Contains the full path to the folder where all the games are.
2423
static char *ethBase;
@@ -292,10 +291,8 @@ static int ethLoadModules(void)
292291
if (sysLoadModuleBuffer(&ps2ip_irx, size_ps2ip_irx, 0, NULL) >= 0) {
293292
sysLoadModuleBuffer(&ps2ips_irx, size_ps2ips_irx, 0, NULL);
294293
sysLoadModuleBuffer(&httpclient_irx, size_httpclient_irx, 0, NULL);
295-
sysLoadModuleBuffer(&lwnbdsvr_irx, size_lwnbdsvr_irx, 0, NULL);
296294
ps2ip_init();
297295
HttpInit();
298-
NBDInit();
299296

300297
LOG("ETHSUPPORT Modules loaded\n");
301298
return 0;
@@ -319,7 +316,6 @@ void ethDeinitModules(void)
319316
HttpDeinit();
320317
nbnsDeinit();
321318
NetManDeinit();
322-
NBDDeinit();
323319
ethModulesLoaded = 0;
324320
gNetworkStartup = ERROR_ETH_NOT_STARTED;
325321

src/lwnbdsupport.c

-104
This file was deleted.

src/menusys.c

+8-9
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@
44
Review OpenUsbLd README & LICENSE files for further details.
55
*/
66

7+
#include "include/opl.h"
8+
#include "include/menusys.h"
9+
#include "include/iosupport.h"
10+
#include "include/renderman.h"
711
#include "include/fntsys.h"
12+
#include "include/lang.h"
13+
#include "include/themes.h"
14+
#include "include/pad.h"
815
#include "include/gui.h"
916
#include "include/guigame.h"
17+
#include "include/system.h"
1018
#include "include/ioman.h"
11-
#include "include/iosupport.h"
12-
#include "include/lang.h"
13-
#include "include/lwnbdsupport.h"
14-
#include "include/menusys.h"
15-
#include "include/opl.h"
16-
#include "include/pad.h"
17-
#include "include/renderman.h"
1819
#include "include/sound.h"
19-
#include "include/system.h"
20-
#include "include/themes.h"
2120
#include <assert.h>
2221

2322
enum MENU_IDs {

src/opl.c

+108
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ hdl_game_info_t *gAutoLaunchGame;
199199
base_game_info_t *gAutoLaunchBDMGame;
200200
char gOPLPart[128];
201201
char *gHDDPrefix;
202+
char gExportName[32];
202203

203204
int gOSDLanguageValue;
204205
int gOSDLanguageEnable;
@@ -922,6 +923,8 @@ static void _loadConfig()
922923
sscanf(temp, "%d.%d.%d.%d", &ps2_gateway[0], &ps2_gateway[1], &ps2_gateway[2], &ps2_gateway[3]);
923924
if (configGetStr(configNet, CONFIG_NET_PS2_DNS, &temp))
924925
sscanf(temp, "%d.%d.%d.%d", &ps2_dns[0], &ps2_dns[1], &ps2_dns[2], &ps2_dns[3]);
926+
927+
configGetStrCopy(configNet, CONFIG_NET_NBD_DEFAULT_EXPORT, gExportName, sizeof(gExportName));
925928
}
926929
}
927930

@@ -1408,7 +1411,112 @@ int oplUpdateGameCompatSingle(int id, item_list_t *support, config_set_t *config
14081411
return CompatUpdateStatus;
14091412
}
14101413

1414+
// ----------------------------------------------------------
1415+
// -------------------- NBD SRV Support ---------------------
1416+
// ----------------------------------------------------------
1417+
1418+
1419+
static int loadLwnbdSvr(void)
1420+
{
1421+
int ret, padStatus;
1422+
struct lwnbd_config
1423+
{
1424+
char defaultexport[32];
1425+
uint8_t readonly;
1426+
};
1427+
struct lwnbd_config config;
1428+
1429+
// deint audio lib while nbd server is running
1430+
audioEnd();
1431+
1432+
// block all io ops, wait for the ones still running to finish
1433+
ioBlockOps(1);
1434+
guiExecDeferredOps();
1435+
1436+
// Deinitialize all support without shutting down the HDD unit.
1437+
deinitAllSupport(NO_EXCEPTION, IO_MODE_SELECTED_ALL);
1438+
clearErrorMessage(); /* At this point, an error might have been displayed (since background tasks were completed).
1439+
Clear it, otherwise it will get displayed after the server is closed. */
14111440

1441+
unloadPads();
1442+
// sysReset(0); // usefull ? printf doesn't work with it.
1443+
1444+
/* compat stuff for user not providing name export (useless when there was only one export) */
1445+
ret = strlen(gExportName);
1446+
if (ret == 0)
1447+
strcpy(config.defaultexport, "hdd0");
1448+
else
1449+
strcpy(config.defaultexport, gExportName);
1450+
1451+
config.readonly = !gEnableWrite;
1452+
1453+
// see gETHStartMode, gNetworkStartup ? this is slow, so if we don't have to do it (like debug build).
1454+
ret = ethLoadInitModules();
1455+
if (ret == 0) {
1456+
ret = sysLoadModuleBuffer(&ps2atad_irx, size_ps2atad_irx, 0, NULL); /* gHDDStartMode ? */
1457+
if (ret >= 0) {
1458+
ret = sysLoadModuleBuffer(&lwnbdsvr_irx, size_lwnbdsvr_irx, sizeof(config), (char *)&config);
1459+
if (ret >= 0)
1460+
ret = 0;
1461+
}
1462+
}
1463+
1464+
padInit(0);
1465+
1466+
// init all pads
1467+
padStatus = 0;
1468+
while (!padStatus)
1469+
padStatus = startPads();
1470+
1471+
// now ready to display some status
1472+
1473+
return ret;
1474+
}
1475+
1476+
static void unloadLwnbdSvr(void)
1477+
{
1478+
ethDeinitModules();
1479+
unloadPads();
1480+
1481+
reset();
1482+
1483+
LOG_INIT();
1484+
LOG_ENABLE();
1485+
1486+
// reinit the input pads
1487+
padInit(0);
1488+
1489+
int ret = 0;
1490+
while (!ret)
1491+
ret = startPads();
1492+
1493+
// now start io again
1494+
ioBlockOps(0);
1495+
1496+
// init all supports again
1497+
initAllSupport(1);
1498+
1499+
audioInit();
1500+
sfxInit(0);
1501+
if (gEnableBGM)
1502+
bgmStart();
1503+
}
1504+
1505+
void handleLwnbdSrv()
1506+
{
1507+
char temp[256];
1508+
// prepare for lwnbd, display screen with info
1509+
guiRenderTextScreen(_l(_STR_STARTINGNBD));
1510+
if (loadLwnbdSvr() == 0) {
1511+
snprintf(temp, sizeof(temp), "%s", _l(_STR_RUNNINGNBD));
1512+
guiMsgBox(temp, 0, NULL);
1513+
} else
1514+
guiMsgBox(_l(_STR_STARTFAILNBD), 0, NULL);
1515+
1516+
// restore normal functionality again
1517+
guiRenderTextScreen(_l(_STR_UNLOADNBD));
1518+
unloadLwnbdSvr();
1519+
}
14121520

14131521
// ----------------------------------------------------------
14141522
// --------------------- Init/Deinit ------------------------

0 commit comments

Comments
 (0)