Implement some SystemService.dll functions

For Rance 01.
This commit is contained in:
Nunuhara Cabbage
2021-10-26 11:45:50 -07:00
parent 488ccc0c74
commit 51d21612d2
6 changed files with 88 additions and 31 deletions
+3
View File
@@ -46,6 +46,9 @@ char *unix_path(const char *path);
char *gamedir_path(const char *path);
char *savedir_path(const char *path);
void get_date(int *year, int *month, int *mday, int *wday);
void get_time(int *hour, int *min, int *sec, int *ms);
#ifndef XSYS4_DATA_DIR
#define XSYS4_DATA_DIR "/usr/local/share/xsystem4"
#endif
+3 -2
View File
@@ -21,6 +21,7 @@
#include "input.h"
#include "sact.h"
#include "CharSpriteManager.h"
#include "xsystem4.h"
#include "hll.h"
static void ChipmunkSpriteEngine_ModuleFini(void)
@@ -154,8 +155,8 @@ HLL_LIBRARY(ChipmunkSpriteEngine,
HLL_EXPORT(Timer_Get, vm_time),
HLL_EXPORT(CG_IsExist, sact_CG_IsExist),
HLL_EXPORT(CG_GetMetrics, sact_CG_GetMetrics),
HLL_EXPORT(System_GetDate, sact_System_GetDate),
HLL_EXPORT(System_GetTime, sact_System_GetTime),
HLL_EXPORT(System_GetDate, get_date),
HLL_EXPORT(System_GetTime, get_time),
HLL_TODO_EXPORT(CG_RotateRGB, SACT2_CG_RotateRGB),
HLL_EXPORT(CG_BlendAMapBin, sact_CG_BlendAMapBin),
HLL_TODO_EXPORT(Debug_Pause, SACT2_Debug_Pause),
+2 -26
View File
@@ -713,30 +713,6 @@ int sact_CG_IsExist(int cg_no)
//void SACT2_CSV_SetInt(int line, int column, int data);
//void SACT2_CSV_Realloc(int lines, int columns);
void sact_System_GetDate(int *year, int *month, int *mday, int *wday)
{
time_t t = time(NULL);
struct tm *tm = localtime(&t);
*year = tm->tm_year;
*month = tm->tm_mon;
*mday = tm->tm_mday;
*wday = tm->tm_wday;
}
void sact_System_GetTime(int *hour, int *min, int *sec, int *ms)
{
time_t t = time(NULL);
struct tm *tm = localtime(&t);
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
*hour = tm->tm_hour;
*min = tm->tm_min;
*sec = ts.tv_sec;
*ms = ts.tv_nsec / 1000000;
}
//void SACT2_CG_RotateRGB(int dst, int dx, int dy, int w, int h, int rotate_type);
void sact_CG_BlendAMapBin(int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int border)
@@ -899,8 +875,8 @@ int SACT2_SP_GetBrightness(int sp_no)
HLL_EXPORT(Sound_GetTimeLength, wav_get_time_length), \
HLL_TODO_EXPORT(Sound_GetGroupNum, SACT2_Sound_GetGroupNum), \
HLL_TODO_EXPORT(Sound_PrepareFromFile, SACT2_Sound_PrepareFromFile), \
HLL_EXPORT(System_GetDate, sact_System_GetDate), \
HLL_EXPORT(System_GetTime, sact_System_GetTime), \
HLL_EXPORT(System_GetDate, get_date), \
HLL_EXPORT(System_GetTime, get_time), \
HLL_TODO_EXPORT(CG_RotateRGB, SACT2_CG_RotateRGB), \
HLL_EXPORT(CG_BlendAMapBin, sact_CG_BlendAMapBin), \
HLL_TODO_EXPORT(Debug_Pause, SACT2_Debug_Pause), \
+2 -2
View File
@@ -905,8 +905,8 @@ HLL_LIBRARY(StoatSpriteEngine,
HLL_TODO_EXPORT(Sound_GetGroupNum, wav_get_group_num),
HLL_EXPORT(Sound_GetGroupNumFromDataNum, StoatSpriteEngine_Sound_GetGroupNumFromDataNum),
HLL_TODO_EXPORT(Sound_PrepareFromFile, wav_prepare_from_file),
HLL_EXPORT(System_GetDate, sact_System_GetDate),
HLL_EXPORT(System_GetTime, sact_System_GetTime),
HLL_EXPORT(System_GetDate, get_date),
HLL_EXPORT(System_GetTime, get_time),
HLL_TODO_EXPORT(CG_RotateRGB, SACT2_CG_RotateRGB),
HLL_EXPORT(CG_BlendAMapBin, sact_CG_BlendAMapBin),
HLL_TODO_EXPORT(Debug_Pause, SACT2_Debug_Pause),
+53 -1
View File
@@ -31,6 +31,14 @@ static int SystemService_GetMixerName(int n, struct string **name)
return 1;
}
static bool SystemService_GetMixerDefaultVolume(int n, int *volume)
{
if (n < 0 || (unsigned)n >= config.mixer_nr_channels)
return false;
*volume = config.mixer_volumes[n];
return true;
}
//bool SystemService_SetMixerName(int nNum, string szName);
//int SystemService_GetGameVersion(void);
@@ -51,6 +59,18 @@ static bool SystemService_IsFullScreen(void)
//bool SystemService_ChangeNormalScreen(void);
HLL_WARN_UNIMPLEMENTED(false, bool, SystemService, ChangeFullScreen);
HLL_WARN_UNIMPLEMENTED(false, bool, SystemService, InitMainWindowPosAndSize);
//static bool SystemService_UpdateView(void);
static int SystemService_GetViewWidth(void)
{
return config.view_width;
}
static int SystemService_GetViewHeight(void)
{
return config.view_height;
}
//bool SystemService_MoveMouseCursorPosImmediately(int nX, int nY);
//bool SystemService_SetHideMouseCursorByGame(bool bHide);
//bool SystemService_GetHideMouseCursorByGame(void);
@@ -125,12 +145,32 @@ static bool SystemService_GetMouseCursorConfig(int type, int *value)
//bool SystemService_IsOpenedMutex(struct string *mutex_name);
//void SystemService_GetGameFolderPath(struct string **folder_path);
static void SystemService_GetTime(int *hour, int *min, int *sec)
{
int ms;
get_time(hour, min, sec, &ms);
}
//static bool SystemService_IsResetOnce(void);
//static void SystemService_OpenPlayingManual(void);
//static bool SystemService_IsExistPlayingManual(void);
//static bool SystemService_IsExistSystemMessage(void);
//static bool SystemService_PopSystemMessage(int *message);
static void SystemService_RestrainScreensaver(void) { }
//static int SystemService_Debug_GetUseVideoMemorySize(void);
static void SystemService_Rance0123456789(struct string **text)
{
*text = cstr_to_string("-RANCE010ECNAR-"); // ???
}
HLL_LIBRARY(SystemService,
HLL_EXPORT(GetMixerNumof, mixer_get_numof),
HLL_EXPORT(GetMixerName, SystemService_GetMixerName),
HLL_EXPORT(GetMixerVolume, mixer_get_volume),
HLL_EXPORT(GetMixerDefaultVolume, SystemService_GetMixerDefaultVolume),
HLL_EXPORT(GetMixerMute, mixer_get_mute),
HLL_TODO_EXPORT(SetMixerName, SystemService_SetMixerName),
HLL_EXPORT(SetMixerVolume, mixer_set_volume),
@@ -142,6 +182,9 @@ HLL_LIBRARY(SystemService,
HLL_TODO_EXPORT(ChangeNormalScreen, SystemService_ChangeNormalScreen),
HLL_EXPORT(ChangeFullScreen, SystemService_ChangeFullScreen),
HLL_EXPORT(InitMainWindowPosAndSize, SystemService_InitMainWindowPosAndSize),
HLL_TODO_EXPORT(UpdateView, SystemService_UpdateView),
HLL_EXPORT(GetViewWidth, SystemService_GetViewWidth),
HLL_EXPORT(GetViewHeight, SystemService_GetViewHeight),
HLL_TODO_EXPORT(MoveMouseCursorPosImmediately, SystemService_MoveMouseCursorPosImmediately),
HLL_TODO_EXPORT(SetHideMouseCursorByGame, SystemService_SetHideMouseCursorByGame),
HLL_TODO_EXPORT(GetHideMouseCursorByGame, SystemService_GetHideMouseCursorByGame),
@@ -154,5 +197,14 @@ HLL_LIBRARY(SystemService,
HLL_TODO_EXPORT(RunProgram, SystemService_RunProgram),
HLL_TODO_EXPORT(IsOpenedMutex, SystemService_IsOpenedMutex),
HLL_TODO_EXPORT(GetGameFolderPath, SystemService_GetGameFolderPath),
HLL_EXPORT(RestrainScreensaver, SystemService_RestrainScreensaver)
HLL_EXPORT(GetDate, get_date),
HLL_EXPORT(GetTime, SystemService_GetTime),
HLL_TODO_EXPORT(IsResetOnce, SystemService_IsResetOnce),
HLL_TODO_EXPORT(OpenPlayingManual, SystemService_OpenPlayingManual),
HLL_TODO_EXPORT(IsExistPlayingManual, SystemService_IsExistPlayingManual),
HLL_TODO_EXPORT(IsExistSystemMessage, SystemService_IsExistSystemMessage),
HLL_TODO_EXPORT(PopSystemMessage, SystemService_PopSystemMessage),
HLL_EXPORT(RestrainScreensaver, SystemService_RestrainScreensaver),
HLL_TODO_EXPORT(Debug_GetUseVideoMemorySize, SystemService_Debug_GetUseVideoMemorySize),
HLL_EXPORT(Rance0123456789, SystemService_Rance0123456789)
);
+25
View File
@@ -24,6 +24,7 @@
#include <signal.h>
#include <getopt.h>
#include <limits.h>
#include <time.h>
#include "system4.h"
#include "system4/ain.h"
@@ -104,6 +105,30 @@ char *savedir_path(const char *path)
return resolve_path(config.save_dir, path);
}
void get_date(int *year, int *month, int *mday, int *wday)
{
time_t t = time(NULL);
struct tm *tm = localtime(&t);
*year = tm->tm_year;
*month = tm->tm_mon;
*mday = tm->tm_mday;
*wday = tm->tm_wday;
}
void get_time(int *hour, int *min, int *sec, int *ms)
{
time_t t = time(NULL);
struct tm *tm = localtime(&t);
struct timespec ts;
clock_gettime(CLOCK_REALTIME, &ts);
*hour = tm->tm_hour;
*min = tm->tm_min;
*sec = ts.tv_sec;
*ms = ts.tv_nsec / 1000000;
}
static struct string *ini_string(struct ini_entry *entry)
{
if (entry->value.type != INI_STRING)