Moved code to dolphin for network
This commit is contained in:
@@ -3,3 +3,8 @@ include(cmake/targets/dolphin.cmake)
|
|||||||
target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME} PUBLIC
|
target_compile_definitions(${DUSK_LIBRARY_TARGET_NAME} PUBLIC
|
||||||
DUSK_GAMECUBE
|
DUSK_GAMECUBE
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Link libraries
|
||||||
|
target_link_libraries(${DUSK_LIBRARY_TARGET_NAME} PRIVATE
|
||||||
|
bba
|
||||||
|
)
|
||||||
|
|||||||
+1
-5
@@ -21,11 +21,7 @@ elseif(DUSK_TARGET_SYSTEM STREQUAL "vita")
|
|||||||
add_subdirectory(dusksdl2)
|
add_subdirectory(dusksdl2)
|
||||||
add_subdirectory(duskgl)
|
add_subdirectory(duskgl)
|
||||||
|
|
||||||
elseif(DUSK_TARGET_SYSTEM STREQUAL "wii")
|
elseif(DUSK_TARGET_SYSTEM STREQUAL "wii" OR DUSK_TARGET_SYSTEM STREQUAL "gamecube")
|
||||||
add_subdirectory(duskwii)
|
|
||||||
add_subdirectory(duskdolphin)
|
|
||||||
|
|
||||||
elseif(DUSK_TARGET_SYSTEM STREQUAL "gamecube")
|
|
||||||
add_subdirectory(duskdolphin)
|
add_subdirectory(duskdolphin)
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
@@ -8,7 +8,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "display/mesh/quad.h"
|
#include "display/mesh/quad.h"
|
||||||
|
|
||||||
#define SPRITEBATCH_SPRITES_MAX 240
|
#define SPRITEBATCH_SPRITES_MAX 32
|
||||||
#define SPRITEBATCH_VERTEX_COUNT (SPRITEBATCH_SPRITES_MAX * QUAD_VERTEX_COUNT)
|
#define SPRITEBATCH_VERTEX_COUNT (SPRITEBATCH_SPRITES_MAX * QUAD_VERTEX_COUNT)
|
||||||
#define SPRITEBATCH_FLUSH_COUNT 4
|
#define SPRITEBATCH_FLUSH_COUNT 4
|
||||||
#define SPRITEBATCH_SPRITES_MAX_PER_FLUSH (\
|
#define SPRITEBATCH_SPRITES_MAX_PER_FLUSH (\
|
||||||
|
|||||||
@@ -98,6 +98,8 @@ errorret_t engineInit(const int32_t argc, const char_t **argv) {
|
|||||||
ENGINE.argc = argc;
|
ENGINE.argc = argc;
|
||||||
ENGINE.argv = argv;
|
ENGINE.argv = argv;
|
||||||
|
|
||||||
|
assertUnreachable("Here fine");
|
||||||
|
|
||||||
// Init systems. Order is important.
|
// Init systems. Order is important.
|
||||||
errorChain(systemInit());
|
errorChain(systemInit());
|
||||||
timeInit();
|
timeInit();
|
||||||
@@ -110,7 +112,7 @@ errorret_t engineInit(const int32_t argc, const char_t **argv) {
|
|||||||
errorChain(sceneInit());
|
errorChain(sceneInit());
|
||||||
entityManagerInit();
|
entityManagerInit();
|
||||||
physicsManagerInit();
|
physicsManagerInit();
|
||||||
errorChain(networkInit());
|
// errorChain(networkInit());
|
||||||
errorChain(gameInit());
|
errorChain(gameInit());
|
||||||
|
|
||||||
sceneLog("Init done, going to queue online in 3 seconds...\n");
|
sceneLog("Init done, going to queue online in 3 seconds...\n");
|
||||||
@@ -170,7 +172,7 @@ errorret_t engineInit(const int32_t argc, const char_t **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
errorret_t engineUpdate(void) {
|
errorret_t engineUpdate(void) {
|
||||||
errorChain(networkUpdate());
|
// errorChain(networkUpdate());
|
||||||
|
|
||||||
timeUpdate();
|
timeUpdate();
|
||||||
inputUpdate();
|
inputUpdate();
|
||||||
@@ -210,7 +212,7 @@ void engineExit(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
errorret_t engineDispose(void) {
|
errorret_t engineDispose(void) {
|
||||||
errorChain(networkDispose());
|
// errorChain(networkDispose());
|
||||||
sceneDispose();
|
sceneDispose();
|
||||||
errorChain(gameDispose());
|
errorChain(gameDispose());
|
||||||
entityManagerDispose();
|
entityManagerDispose();
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "dusk.h"
|
#include "dusk.h"
|
||||||
|
|
||||||
#define ENTITY_COUNT_MAX 64
|
#define ENTITY_COUNT_MAX 6
|
||||||
#define ENTITY_COMPONENT_COUNT_MAX 16
|
#define ENTITY_COMPONENT_COUNT_MAX 6
|
||||||
|
|
||||||
typedef uint8_t entityid_t;
|
typedef uint8_t entityid_t;
|
||||||
typedef uint8_t componentid_t;
|
typedef uint8_t componentid_t;
|
||||||
|
|||||||
@@ -19,4 +19,5 @@ add_subdirectory(asset)
|
|||||||
add_subdirectory(log)
|
add_subdirectory(log)
|
||||||
add_subdirectory(display)
|
add_subdirectory(display)
|
||||||
add_subdirectory(input)
|
add_subdirectory(input)
|
||||||
|
add_subdirectory(network)
|
||||||
add_subdirectory(system)
|
add_subdirectory(system)
|
||||||
@@ -9,3 +9,11 @@
|
|||||||
#include <ogcsys.h>
|
#include <ogcsys.h>
|
||||||
#include <gccore.h>
|
#include <gccore.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
|
|
||||||
|
#ifdef DUSK_GAMECUBE
|
||||||
|
#define CONF_ASPECT_4_3 0
|
||||||
|
#define CONF_ASPECT_16_9 1
|
||||||
|
#define CONF_GetAspectRatio() CONF_ASPECT_4_3
|
||||||
|
|
||||||
|
#define CONF_GetLanguage() SYS_GetLanguage()
|
||||||
|
#endif
|
||||||
@@ -5,5 +5,5 @@
|
|||||||
|
|
||||||
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
target_sources(${DUSK_LIBRARY_TARGET_NAME}
|
||||||
PUBLIC
|
PUBLIC
|
||||||
networkwii.c
|
networkdolphin.c
|
||||||
)
|
)
|
||||||
@@ -1,34 +1,36 @@
|
|||||||
/**
|
// /**
|
||||||
* Copyright (c) 2026 Dominic Masters
|
// * Copyright (c) 2026 Dominic Masters
|
||||||
*
|
// *
|
||||||
* This software is released under the MIT License.
|
// * This software is released under the MIT License.
|
||||||
* https://opensource.org/licenses/MIT
|
// * https://opensource.org/licenses/MIT
|
||||||
*/
|
// */
|
||||||
|
|
||||||
#include "network/network.h"
|
#include "network/network.h"
|
||||||
#include "util/memory.h"
|
#include "util/memory.h"
|
||||||
#include "assert/assert.h"
|
#include "assert/assert.h"
|
||||||
|
|
||||||
errorret_t networkWiiInit() {
|
errorret_t networkDolphinInit() {
|
||||||
s32 ret = net_init();
|
// s32 ret = net_init();
|
||||||
if(ret < 0) errorThrow("Failed to init Wii network stack: %d", ret);
|
// if(ret < 0) errorThrow("Failed to init network stack: %d", ret);
|
||||||
errorOk();
|
errorOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
errorret_t networkWiiUpdate() {
|
errorret_t networkDolphinUpdate() {
|
||||||
errorOk();
|
errorOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
errorret_t networkWiiDispose() {
|
errorret_t networkDolphinDispose() {
|
||||||
net_deinit();
|
// #ifdef DUSK_WII
|
||||||
|
// net_deinit();
|
||||||
|
// #endif
|
||||||
errorOk();
|
errorOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t networkWiiIsConnected() {
|
bool_t networkDolphinIsConnected() {
|
||||||
return NETWORK.state == NETWORK_STATE_CONNECTED;
|
return NETWORK.state == NETWORK_STATE_CONNECTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void networkWiiRequestConnection(
|
void networkDolphinRequestConnection(
|
||||||
void (*onConnected)(void *user),
|
void (*onConnected)(void *user),
|
||||||
void (*onFailed)(errorret_t error, void *user),
|
void (*onFailed)(errorret_t error, void *user),
|
||||||
void (*onDisconnect)(errorret_t error, void *user),
|
void (*onDisconnect)(errorret_t error, void *user),
|
||||||
@@ -74,13 +76,13 @@ void networkWiiRequestConnection(
|
|||||||
&NETWORK.errorState,
|
&NETWORK.errorState,
|
||||||
ERROR_NOT_OK,
|
ERROR_NOT_OK,
|
||||||
__FILE__, __func__, __LINE__,
|
__FILE__, __func__, __LINE__,
|
||||||
"Failed to connect to Wii network"
|
"Failed to connect to network"
|
||||||
);
|
);
|
||||||
NETWORK.platform.onFailed(error, NETWORK.platform.onConnectedUser);
|
NETWORK.platform.onFailed(error, NETWORK.platform.onConnectedUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void networkWiiRequestDisconnection(
|
void networkDolphinRequestDisconnection(
|
||||||
void (*onComplete)(void *user),
|
void (*onComplete)(void *user),
|
||||||
void *user
|
void *user
|
||||||
) {
|
) {
|
||||||
@@ -93,7 +95,7 @@ void networkWiiRequestDisconnection(
|
|||||||
onComplete(user);
|
onComplete(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
networkinfo_t networkWiiGetInfo() {
|
networkinfo_t networkDolphinGetInfo() {
|
||||||
networkinfo_t info;
|
networkinfo_t info;
|
||||||
memoryZero(&info, sizeof(networkinfo_t));
|
memoryZero(&info, sizeof(networkinfo_t));
|
||||||
|
|
||||||
@@ -106,7 +108,7 @@ networkinfo_t networkWiiGetInfo() {
|
|||||||
&info.ipv4.ip[2],
|
&info.ipv4.ip[2],
|
||||||
&info.ipv4.ip[3]
|
&info.ipv4.ip[3]
|
||||||
);
|
);
|
||||||
assertTrue(ret == 4, "Failed to parse Wii IP address");
|
assertTrue(ret == 4, "Failed to parse IP address");
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
@@ -10,46 +10,46 @@
|
|||||||
#include "network/networkinfo.h"
|
#include "network/networkinfo.h"
|
||||||
#include <network.h>
|
#include <network.h>
|
||||||
|
|
||||||
#define NETWORK_WII_IP_MAX 16
|
#define NETWORK_DOLPHIN_IP_MAX 16
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
char_t ip[NETWORK_WII_IP_MAX];
|
char_t ip[NETWORK_DOLPHIN_IP_MAX];
|
||||||
char_t netmask[NETWORK_WII_IP_MAX];
|
char_t netmask[NETWORK_DOLPHIN_IP_MAX];
|
||||||
char_t gateway[NETWORK_WII_IP_MAX];
|
char_t gateway[NETWORK_DOLPHIN_IP_MAX];
|
||||||
|
|
||||||
void *onConnectedUser;
|
void *onConnectedUser;
|
||||||
void (*onConnected)(void *user);
|
void (*onConnected)(void *user);
|
||||||
void (*onFailed)(errorret_t error, void *user);
|
void (*onFailed)(errorret_t error, void *user);
|
||||||
} networkwii_t;
|
} networkdolphin_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the Wii network stack via IOS. Does not connect; use
|
* Initializes the Wii network stack via IOS. Does not connect; use
|
||||||
* networkWiiRequestConnection for that.
|
* networkDolphinRequestConnection for that.
|
||||||
*
|
*
|
||||||
* @return Error state (if any).
|
* @return Error state (if any).
|
||||||
*/
|
*/
|
||||||
errorret_t networkWiiInit();
|
errorret_t networkDolphinInit();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called each frame. No-op on Wii since connection is synchronous.
|
* Called each frame. No-op on Wii since connection is synchronous.
|
||||||
*
|
*
|
||||||
* @return Error state (if any).
|
* @return Error state (if any).
|
||||||
*/
|
*/
|
||||||
errorret_t networkWiiUpdate();
|
errorret_t networkDolphinUpdate();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disposes the Wii network stack.
|
* Disposes the Wii network stack.
|
||||||
*
|
*
|
||||||
* @return Error state (if any).
|
* @return Error state (if any).
|
||||||
*/
|
*/
|
||||||
errorret_t networkWiiDispose();
|
errorret_t networkDolphinDispose();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the Wii is connected to a network.
|
* Returns true if the Wii is connected to a network.
|
||||||
*
|
*
|
||||||
* @return True if connected.
|
* @return True if connected.
|
||||||
*/
|
*/
|
||||||
bool_t networkWiiIsConnected();
|
bool_t networkDolphinIsConnected();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Requests the Wii to connect to the network using the Wi-Fi settings saved
|
* Requests the Wii to connect to the network using the Wi-Fi settings saved
|
||||||
@@ -60,7 +60,7 @@ bool_t networkWiiIsConnected();
|
|||||||
* @param onDisconnect Callback when connection is later lost.
|
* @param onDisconnect Callback when connection is later lost.
|
||||||
* @param user User data passed to all callbacks.
|
* @param user User data passed to all callbacks.
|
||||||
*/
|
*/
|
||||||
void networkWiiRequestConnection(
|
void networkDolphinRequestConnection(
|
||||||
void (*onConnected)(void *user),
|
void (*onConnected)(void *user),
|
||||||
void (*onFailed)(errorret_t error, void *user),
|
void (*onFailed)(errorret_t error, void *user),
|
||||||
void (*onDisconnect)(errorret_t error, void *user),
|
void (*onDisconnect)(errorret_t error, void *user),
|
||||||
@@ -73,7 +73,7 @@ void networkWiiRequestConnection(
|
|||||||
* @param onComplete Callback when disconnection is complete.
|
* @param onComplete Callback when disconnection is complete.
|
||||||
* @param user User data passed to the callback.
|
* @param user User data passed to the callback.
|
||||||
*/
|
*/
|
||||||
void networkWiiRequestDisconnection(
|
void networkDolphinRequestDisconnection(
|
||||||
void (*onComplete)(void *user),
|
void (*onComplete)(void *user),
|
||||||
void *user
|
void *user
|
||||||
);
|
);
|
||||||
@@ -83,4 +83,4 @@ void networkWiiRequestDisconnection(
|
|||||||
*
|
*
|
||||||
* @return Network info for the active connection.
|
* @return Network info for the active connection.
|
||||||
*/
|
*/
|
||||||
networkinfo_t networkWiiGetInfo();
|
networkinfo_t networkDolphinGetInfo();
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2026 Dominic Masters
|
||||||
|
*
|
||||||
|
* This software is released under the MIT License.
|
||||||
|
* https://opensource.org/licenses/MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
#include "networkdolphin.h"
|
||||||
|
|
||||||
|
#define networkPlatformInit networkDolphinInit
|
||||||
|
#define networkPlatformUpdate networkDolphinUpdate
|
||||||
|
#define networkPlatformDispose networkDolphinDispose
|
||||||
|
#define networkPlatformIsConnected networkDolphinIsConnected
|
||||||
|
#define networkPlatformRequestConnection networkDolphinRequestConnection
|
||||||
|
#define networkPlatformRequestDisconnection networkDolphinRequestDisconnection
|
||||||
|
#define networkPlatformGetInfo networkDolphinGetInfo
|
||||||
|
|
||||||
|
typedef networkdolphin_t networkplatform_t;
|
||||||
@@ -40,6 +40,9 @@ int32_t systemGetAspectRatioDolphin(void);
|
|||||||
* Refer to;
|
* Refer to;
|
||||||
* https://github.com/devkitPro/libogc/blob/20d90e944b83c8991538e88b00b1e5f309428e85/gc/ogc/conf.h#L190
|
* https://github.com/devkitPro/libogc/blob/20d90e944b83c8991538e88b00b1e5f309428e85/gc/ogc/conf.h#L190
|
||||||
*
|
*
|
||||||
|
* On gamecube, refer to;
|
||||||
|
* https://libogc.devkitpro.org/system_8h.html
|
||||||
|
*
|
||||||
* @return System language.
|
* @return System language.
|
||||||
*/
|
*/
|
||||||
int32_t systemGetLanguageDolphin(void);
|
int32_t systemGetLanguageDolphin(void);
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
# Copyright (c) 2026 Dominic Masters
|
|
||||||
#
|
|
||||||
# This software is released under the MIT License.
|
|
||||||
# https://opensource.org/licenses/MIT
|
|
||||||
|
|
||||||
# Includes
|
|
||||||
target_include_directories(${DUSK_LIBRARY_TARGET_NAME}
|
|
||||||
PUBLIC
|
|
||||||
${CMAKE_CURRENT_LIST_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
# Sources
|
|
||||||
target_sources(${DUSK_BINARY_TARGET_NAME}
|
|
||||||
PUBLIC
|
|
||||||
)
|
|
||||||
|
|
||||||
# Subdirs
|
|
||||||
add_subdirectory(network)
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2026 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include "networkwii.h"
|
|
||||||
|
|
||||||
#define networkPlatformInit networkWiiInit
|
|
||||||
#define networkPlatformUpdate networkWiiUpdate
|
|
||||||
#define networkPlatformDispose networkWiiDispose
|
|
||||||
#define networkPlatformIsConnected networkWiiIsConnected
|
|
||||||
#define networkPlatformRequestConnection networkWiiRequestConnection
|
|
||||||
#define networkPlatformRequestDisconnection networkWiiRequestDisconnection
|
|
||||||
#define networkPlatformGetInfo networkWiiGetInfo
|
|
||||||
|
|
||||||
typedef networkwii_t networkplatform_t;
|
|
||||||
Reference in New Issue
Block a user