mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-10-11 08:48:16 +03:00
Use libffi for library calls
Use libffi to portably call arbitrary functions at runtime, rather than forcing library functions to use a standard prototype.
This commit is contained in:
@@ -11,7 +11,17 @@ NOTE: This is a work in progress. Some simple ADV games run more or less okay,
|
||||
Building
|
||||
--------
|
||||
|
||||
xsystem4 uses the meson build system.
|
||||
First install the dependencies (corresponding Debian package in parentheses):
|
||||
|
||||
* chibi-scheme [optional, for debugger]
|
||||
* meson (meson)
|
||||
* libffi (libffi-dev)
|
||||
* SDL2 (libsdl2-dev)
|
||||
* SDL2_mixer (libsdl2-mixer-dev)
|
||||
* SDL2_ttf (libsdl2-ttf-dev)
|
||||
* zlib (zlib1g-dev)
|
||||
|
||||
Then build the xsystem4 executable with meson,
|
||||
|
||||
mkdir build
|
||||
meson build
|
||||
|
||||
+32
-4
@@ -25,6 +25,7 @@
|
||||
#include "gfx/types.h"
|
||||
|
||||
struct string;
|
||||
struct page;
|
||||
union vm_value;
|
||||
|
||||
struct sact_sprite {
|
||||
@@ -51,30 +52,57 @@ struct texture *sact_get_texture(int sp_no);
|
||||
|
||||
void sact_render_scene(void);
|
||||
|
||||
int sact_Init(void);
|
||||
int sact_Init(void *_, int cg_cache_size);
|
||||
int sact_SetWP(int cg_no);
|
||||
int sact_SetWP_Color(int r, int g, int b);
|
||||
int sact_GetScreenWidth(void);
|
||||
int sact_GetScreenHeight(void);
|
||||
int sact_GetMainSurfaceNumber(void);
|
||||
int sact_Update(void);
|
||||
int sact_Effect(int type, int time, int key);
|
||||
int sact_SP_GetUnuseNum(int min);
|
||||
int sact_SP_Count(void);
|
||||
int sact_SP_Enum(union vm_value *array, int size);
|
||||
int sact_SP_Enum(struct page **array);
|
||||
int sact_SP_GetMaxZ(void);
|
||||
int sact_SP_SetCG(int sp, int cg);
|
||||
int sact_SP_Create(int sp, int width, int height, int r, int g, int b, int a);
|
||||
int sact_SP_CreatePixelOnly(int sp, int width, int height);
|
||||
int sact_SP_Delete(int sp);
|
||||
int sact_SP_SetPos(int sp_no, int x, int y);
|
||||
int sact_SP_SetX(int sp_no, int x);
|
||||
int sact_SP_SetY(int sp_no, int y);
|
||||
int sact_SP_SetZ(int sp, int z);
|
||||
int sact_SP_GetBlendRate(int sp_no);
|
||||
int sact_SP_SetBlendRate(int sp_no, int rate);
|
||||
int sact_SP_SetShow(int sp_no, bool show);
|
||||
int sact_SP_SetDrawMethod(int sp_no, int method);
|
||||
int sact_SP_GetDrawMethod(int sp_no);
|
||||
int sact_SP_IsUsing(int sp_no);
|
||||
int sact_SP_ExistsAlpha(int sp_no);
|
||||
int sact_SP_TextDraw(int sp_no, struct string *text, union vm_value *tm);
|
||||
int sact_SP_GetPosX(int sp_no);
|
||||
int sact_SP_GetPosY(int sp_no);
|
||||
int sact_SP_GetWidth(int sp_no);
|
||||
int sact_SP_GetHeight(int sp_no);
|
||||
int sact_SP_GetZ(int sp_no);
|
||||
int sact_SP_GetShow(int sp_no);
|
||||
int sact_SP_SetTextHome(int sp_no, int x, int y);
|
||||
int sact_SP_SetTextLineSpace(int sp_no, int px);
|
||||
int sact_SP_SetTextCharSpace(int sp_no, int px);
|
||||
int sact_SP_SetTextPos(int sp_no, int x, int y);
|
||||
int sact_SP_TextDraw(int sp_no, struct string *text, struct page *tm);
|
||||
int sact_SP_TextClear(int sp_no);
|
||||
int sact_SP_TextHome(int sp_no, int size);
|
||||
int sact_SP_TextNewLine(int sp_no, int size);
|
||||
int sact_SP_TextCopy(int dno, int sno);
|
||||
int sact_SP_GetTextHomeX(int sp_no);
|
||||
int sact_SP_GetTextHomeY(int sp_no);
|
||||
int sact_SP_GetTextCharSpace(int sp_no);
|
||||
int sact_SP_GetTextPosX(int sp_no);
|
||||
int sact_SP_GetTextPosY(int sp_no);
|
||||
int sact_SP_GetTextLineSpace(int sp_no);
|
||||
int sact_SP_IsPtIn(int sp_no, int x, int y);
|
||||
int sact_CG_GetMetrics(int cg_no, union vm_value *cgm);
|
||||
int sact_SP_IsPtInRect(int sp_no, int x, int y);
|
||||
int sact_CG_GetMetrics(int cg_no, struct page **page);
|
||||
int sact_SP_GetAMapValue(int sp_no, int x, int y);
|
||||
int sact_SP_GetPixelValue(int sp_no, int x, int y, int *r, int *g, int *b);
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "cJSON.h"
|
||||
#include "vm.h"
|
||||
|
||||
cJSON *page_to_json(struct page *page);
|
||||
cJSON *vm_value_to_json(enum ain_data_type type, union vm_value val);
|
||||
void json_load_page(struct page *page, cJSON *vars);
|
||||
union vm_value json_to_vm_value(enum ain_data_type type, enum ain_data_type struct_type, int array_rank, cJSON *json);
|
||||
|
||||
@@ -83,6 +83,17 @@ enum ain_data_type {
|
||||
case AIN_ARRAY_LONG_INT: \
|
||||
case AIN_ARRAY_DELEGATE
|
||||
|
||||
#define AIN_REF_ARRAY_TYPE \
|
||||
AIN_REF_ARRAY_INT: \
|
||||
case AIN_REF_ARRAY_FLOAT: \
|
||||
case AIN_REF_ARRAY_STRING: \
|
||||
case AIN_REF_ARRAY_STRUCT: \
|
||||
case AIN_REF_ARRAY_FUNC_TYPE: \
|
||||
case AIN_REF_ARRAY_BOOL: \
|
||||
case AIN_REF_ARRAY_LONG_INT: \
|
||||
case AIN_REF_ARRAY_DELEGATE
|
||||
|
||||
|
||||
#define AIN_REF_TYPE \
|
||||
AIN_REF_INT: \
|
||||
case AIN_REF_FLOAT: \
|
||||
|
||||
@@ -50,6 +50,7 @@ void string_append_cstr(struct string **a, const char *b, size_t b_size);
|
||||
void string_push_back(struct string **s, int c);
|
||||
void string_pop_back(struct string **s);
|
||||
void string_erase(struct string **s, int index);
|
||||
void string_clear(struct string *s);
|
||||
|
||||
// queries
|
||||
int string_find(const struct string *haystack, const struct string *needle);
|
||||
|
||||
+6
-6
@@ -31,20 +31,17 @@ union vm_value {
|
||||
int32_t i;
|
||||
int64_t li;
|
||||
float f;
|
||||
// HLL only
|
||||
void *ref;
|
||||
int *iref;
|
||||
float *fref;
|
||||
void *ref; // for casting HLL return value
|
||||
};
|
||||
|
||||
struct static_hll_function {
|
||||
char *name;
|
||||
union vm_value (*fun)(union vm_value *_args);
|
||||
void *fun;
|
||||
};
|
||||
|
||||
struct static_library {
|
||||
char *name;
|
||||
struct static_hll_function **functions;
|
||||
struct static_hll_function functions[];
|
||||
};
|
||||
|
||||
struct ain *ain;
|
||||
@@ -111,6 +108,9 @@ void vm_execute_ain(struct ain *program);
|
||||
void vm_call(int fno, int struct_page);
|
||||
int vm_time(void);
|
||||
|
||||
void hll_call(int libno, int fno);
|
||||
void link_libraries(void);
|
||||
|
||||
void vm_stack_trace(void);
|
||||
noreturn void _vm_error(const char *fmt, ...);
|
||||
noreturn void vm_exit(int code);
|
||||
|
||||
@@ -7,6 +7,7 @@ libm = meson.get_compiler('c').find_library('m', required: false)
|
||||
sdl2 = dependency('sdl2')
|
||||
sdl2ttf = dependency('SDL2_ttf')
|
||||
sdl2mixer = dependency('SDL2_mixer')
|
||||
ffi = dependency('libffi')
|
||||
gl = dependency('GL')
|
||||
glew = dependency('glew')
|
||||
chibi = dependency('chibi-scheme', required : get_option('debugger'))
|
||||
|
||||
@@ -0,0 +1,235 @@
|
||||
/* Copyright (C) 2019 Nunuhara Cabbage <nunuhara@haniwa.technology>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#include <ffi.h>
|
||||
#include "system4/ain.h"
|
||||
#include "vm.h"
|
||||
#include "vm/heap.h"
|
||||
#include "vm/page.h"
|
||||
|
||||
#define HLL_MAX_ARGS 64
|
||||
|
||||
struct hll_function {
|
||||
void *fun;
|
||||
ffi_cif cif;
|
||||
unsigned int nr_args;
|
||||
ffi_type **args;
|
||||
ffi_type *return_type;
|
||||
};
|
||||
|
||||
static struct hll_function **libraries;
|
||||
|
||||
void hll_call(int libno, int fno)
|
||||
{
|
||||
struct ain_hll_function *f = &ain->libraries[libno].functions[fno];
|
||||
|
||||
if (!libraries[libno])
|
||||
VM_ERROR("Unimplemented HLL function: %s.%s", ain->libraries[libno].name, f->name);
|
||||
|
||||
struct hll_function *fun = &libraries[libno][fno];
|
||||
if (!fun->fun)
|
||||
VM_ERROR("Unimplemented HLL function: %s.%s", ain->libraries[libno].name, f->name);
|
||||
|
||||
void *args[HLL_MAX_ARGS];
|
||||
void *ptrs[HLL_MAX_ARGS];
|
||||
for (int i = f->nr_arguments - 1; i >= 0; i--) {
|
||||
switch (f->arguments[i].data_type) {
|
||||
case AIN_REF_INT:
|
||||
case AIN_REF_LONG_INT:
|
||||
case AIN_REF_BOOL:
|
||||
case AIN_REF_FLOAT: {
|
||||
// need to create pointer for immediate ref types
|
||||
stack_ptr -= 2;
|
||||
int pageno = stack[stack_ptr].i;
|
||||
int varno = stack[stack_ptr+1].i;
|
||||
ptrs[i] = &heap[pageno].page->values[varno];
|
||||
args[i] = &ptrs[i];
|
||||
break;
|
||||
}
|
||||
case AIN_STRING:
|
||||
stack_ptr--;
|
||||
args[i] = &heap[stack[stack_ptr].i].s;
|
||||
break;
|
||||
case AIN_REF_STRING:
|
||||
stack_ptr--;
|
||||
ptrs[i] = &heap[stack[stack_ptr].i].s;
|
||||
args[i] = &ptrs[i];
|
||||
break;
|
||||
case AIN_STRUCT:
|
||||
case AIN_ARRAY_TYPE:
|
||||
stack_ptr--;
|
||||
args[i] = &heap[stack[stack_ptr].i].page;
|
||||
break;
|
||||
case AIN_REF_STRUCT:
|
||||
case AIN_REF_ARRAY_TYPE:
|
||||
stack_ptr--;
|
||||
ptrs[i] = &heap[stack[stack_ptr].i].page;
|
||||
args[i] = &ptrs[i];
|
||||
break;
|
||||
default:
|
||||
stack_ptr--;
|
||||
args[i] = &stack[stack_ptr];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
union vm_value r;
|
||||
ffi_call(&fun->cif, (void*)fun->fun, &r, args);
|
||||
|
||||
for (int i = 0, j = 0; i < f->nr_arguments; i++, j++) {
|
||||
// XXX: We don't increase the ref count when passing ref arguments to HLL
|
||||
// functions, so we need to avoid decreasing it via variable_fini
|
||||
switch (f->arguments[i].data_type) {
|
||||
case AIN_REF_INT:
|
||||
case AIN_REF_LONG_INT:
|
||||
case AIN_REF_BOOL:
|
||||
case AIN_REF_FLOAT:
|
||||
j++;
|
||||
break;
|
||||
case AIN_REF_STRING:
|
||||
case AIN_REF_STRUCT:
|
||||
case AIN_REF_FUNC_TYPE:
|
||||
case AIN_REF_ARRAY_TYPE:
|
||||
break;
|
||||
default:
|
||||
variable_fini(stack[stack_ptr+j], f->arguments[i].data_type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (f->data_type != AIN_VOID) {
|
||||
if (f->data_type == AIN_STRING) {
|
||||
int slot = heap_alloc_slot(VM_STRING);
|
||||
heap[slot].s = r.ref;
|
||||
} else {
|
||||
stack_push(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern struct static_library lib_ACXLoader;
|
||||
extern struct static_library lib_AliceLogo;
|
||||
extern struct static_library lib_AliceLogo2;
|
||||
extern struct static_library lib_AliceLogo3;
|
||||
extern struct static_library lib_Confirm2;
|
||||
extern struct static_library lib_DrawGraph;
|
||||
extern struct static_library lib_DrawPluginManager;
|
||||
extern struct static_library lib_File;
|
||||
extern struct static_library lib_Math;
|
||||
extern struct static_library lib_MsgLogManager;
|
||||
extern struct static_library lib_MsgSkip;
|
||||
extern struct static_library lib_OutputLog;
|
||||
extern struct static_library lib_PlayMovie;
|
||||
extern struct static_library lib_SACT2;
|
||||
extern struct static_library lib_SystemServiceEx;
|
||||
|
||||
static struct static_library *static_libraries[] = {
|
||||
&lib_ACXLoader,
|
||||
&lib_AliceLogo,
|
||||
&lib_AliceLogo2,
|
||||
&lib_AliceLogo3,
|
||||
&lib_Confirm2,
|
||||
&lib_DrawGraph,
|
||||
&lib_DrawPluginManager,
|
||||
&lib_File,
|
||||
&lib_Math,
|
||||
&lib_MsgLogManager,
|
||||
&lib_MsgSkip,
|
||||
&lib_OutputLog,
|
||||
&lib_PlayMovie,
|
||||
&lib_SACT2,
|
||||
&lib_SystemServiceEx,
|
||||
NULL
|
||||
};
|
||||
|
||||
static ffi_type *ain_to_ffi_type(enum ain_data_type type)
|
||||
{
|
||||
switch (type) {
|
||||
case AIN_VOID:
|
||||
return &ffi_type_void;
|
||||
case AIN_INT:
|
||||
case AIN_BOOL:
|
||||
return &ffi_type_sint32;
|
||||
case AIN_LONG_INT:
|
||||
return &ffi_type_sint64;
|
||||
case AIN_FLOAT:
|
||||
return &ffi_type_float;
|
||||
case AIN_STRING:
|
||||
case AIN_STRUCT:
|
||||
case AIN_FUNC_TYPE:
|
||||
case AIN_DELEGATE:
|
||||
case AIN_ARRAY_TYPE:
|
||||
case AIN_REF_TYPE:
|
||||
case AIN_IMAIN_SYSTEM: // ???
|
||||
return &ffi_type_pointer;
|
||||
default:
|
||||
ERROR("Unhandled type in HLL function: %s", ain_strtype(ain, type, -1));
|
||||
}
|
||||
}
|
||||
|
||||
static void link_static_library_function(struct hll_function *dst, struct ain_hll_function *src, void *funcptr)
|
||||
{
|
||||
dst->fun = funcptr;
|
||||
dst->nr_args = src->nr_arguments;
|
||||
dst->args = xcalloc(dst->nr_args, sizeof(ffi_type*));
|
||||
|
||||
for (unsigned int i = 0; i < dst->nr_args; i++) {
|
||||
dst->args[i] = ain_to_ffi_type(src->arguments[i].data_type);
|
||||
}
|
||||
dst->return_type = ain_to_ffi_type(src->data_type);
|
||||
|
||||
if (ffi_prep_cif(&dst->cif, FFI_DEFAULT_ABI, dst->nr_args, dst->return_type, dst->args) != FFI_OK)
|
||||
ERROR("Failed to link HLL function");
|
||||
}
|
||||
|
||||
/*
|
||||
* "Link" a library that has been compiled into the xsystem4 executable.
|
||||
*/
|
||||
static struct hll_function *link_static_library(struct ain_library *ainlib, struct static_library *lib)
|
||||
{
|
||||
struct hll_function *dst = xcalloc(ainlib->nr_functions, sizeof(struct hll_function));
|
||||
|
||||
for (int i = 0; i < ainlib->nr_functions; i++) {
|
||||
for (int j = 0; lib->functions[j].name; j++) {
|
||||
if (!strcmp(ainlib->functions[i].name, lib->functions[j].name)) {
|
||||
link_static_library_function(&dst[i], &ainlib->functions[i], lib->functions[j].fun);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!dst[i].fun)
|
||||
WARNING("Unimplemented library function: %s.%s", ainlib->name, ainlib->functions[i].name);
|
||||
else if (ainlib->functions[i].nr_arguments >= HLL_MAX_ARGS)
|
||||
ERROR("Too many arguments to library function: %s", ainlib->functions[i].name);
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
void link_libraries(void)
|
||||
{
|
||||
libraries = xcalloc(ain->nr_libraries, sizeof(struct hll_function*));
|
||||
|
||||
for (int i = 0; i < ain->nr_libraries; i++) {
|
||||
for (int j = 0; static_libraries[j]; j++) {
|
||||
if (!strcmp(ain->libraries[i].name, static_libraries[j]->name)) {
|
||||
libraries[i] = link_static_library(&ain->libraries[i], static_libraries[j]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!libraries[i])
|
||||
WARNING("Unimplemented library: %s", ain->libraries[i].name);
|
||||
}
|
||||
}
|
||||
+29
-39
@@ -20,6 +20,7 @@
|
||||
#include "hll.h"
|
||||
#include "little_endian.h"
|
||||
#include "system4/string.h"
|
||||
#include "vm/page.h"
|
||||
|
||||
struct acx_file {
|
||||
int compressed_size;
|
||||
@@ -33,17 +34,17 @@ struct acx_file {
|
||||
static struct acx_file acx;
|
||||
|
||||
//bool Load(string pIFileName)
|
||||
hll_defun(Load, args)
|
||||
bool ACXLoader_Load(struct string *filename)
|
||||
{
|
||||
FILE *fp;
|
||||
long len;
|
||||
uint8_t *buf = NULL;
|
||||
char *path = gamedir_path(heap[args[0].i].s->text);
|
||||
char *path = gamedir_path(filename->text);
|
||||
|
||||
if (!(fp = fopen(path, "rb"))) {
|
||||
WARNING("ACXLoader.Load: Failed to open %s", path);
|
||||
free(path);
|
||||
hll_return(false);
|
||||
return false;
|
||||
}
|
||||
free(path);
|
||||
|
||||
@@ -60,7 +61,7 @@ hll_defun(Load, args)
|
||||
// check magic
|
||||
if (strncmp((char*)buf, "ACX\0\0\0\0", 0)) {
|
||||
free(buf);
|
||||
hll_return(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
acx.compressed_size = LittleEndian_getDW(buf, 8);
|
||||
@@ -71,7 +72,7 @@ hll_defun(Load, args)
|
||||
if (Z_OK != uncompress(acx.data_raw, &size, buf+16, len-16)) {
|
||||
WARNING("ACXLoader.Load: uncompress failed");
|
||||
free(buf);
|
||||
hll_return(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
acx.nr_columns = LittleEndian_getDW(acx.data_raw, 0);
|
||||
@@ -79,70 +80,59 @@ hll_defun(Load, args)
|
||||
acx.data = acx.data_raw + (8 + acx.nr_columns * 4);
|
||||
|
||||
free(buf);
|
||||
hll_return(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
//void Release()
|
||||
hll_defun(Release, args)
|
||||
void ACXLoader_Release(void)
|
||||
{
|
||||
free(acx.data_raw);
|
||||
memset(&acx, 0, sizeof(struct acx_file));
|
||||
hll_return(0);
|
||||
}
|
||||
|
||||
//int GetNumofLine()
|
||||
hll_defun(GetNumofLine, args)
|
||||
int ACXLoader_GetNumofLine(void)
|
||||
{
|
||||
hll_return(acx.nr_lines);
|
||||
return acx.nr_lines;
|
||||
}
|
||||
|
||||
//int GetNumofColumn()
|
||||
hll_defun(GetNumofColumn, args)
|
||||
int ACXLoader_GetNumofColumn(void)
|
||||
{
|
||||
hll_return(acx.nr_columns);
|
||||
return acx.nr_columns;
|
||||
}
|
||||
|
||||
//bool GetDataInt(int nLine, int nColumn, ref int pnData)
|
||||
hll_defun(GetDataInt, args)
|
||||
bool ACXLoader_GetDataInt(int line, int col, int *ptr)
|
||||
{
|
||||
int line = args[0].i;
|
||||
int col = args[1].i;
|
||||
|
||||
if (line < 0 || line >= acx.nr_lines || col < 0 || col >= acx.nr_columns)
|
||||
hll_return(false);
|
||||
return false;
|
||||
|
||||
uint8_t *data = acx.data + (line * acx.nr_columns * 4) + (col * 4);
|
||||
*args[2].iref = LittleEndian_getDW(data, 0);
|
||||
*ptr = LittleEndian_getDW(data, 0);
|
||||
|
||||
hll_return(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
//bool GetDataString(int nLine, int nColumn, ref string pIData)
|
||||
hll_unimplemented(ACXLoader, GetDataString);
|
||||
HLL_UNIMPLEMENTED(bool, ACXLoader, GetDataString, int line, int col, struct string *data);
|
||||
|
||||
//bool GetDataStruct(int nLine, ref struct pIVMStruct2)
|
||||
hll_defun(GetDataStruct, args)
|
||||
bool ACXLoader_GetDataStruct(int line, struct page **page)
|
||||
{
|
||||
int line = args[0].i;
|
||||
union vm_value *s = hll_struct_ref(args[1].i);
|
||||
union vm_value *s = (*page)->values;
|
||||
|
||||
if (line >= acx.nr_lines)
|
||||
hll_return(false);
|
||||
return false;
|
||||
|
||||
uint8_t *data = acx.data + (line * acx.nr_columns * 4);
|
||||
for (int i = 0; i < acx.nr_columns; i++) {
|
||||
s[i].i = LittleEndian_getDW(data, i*4);
|
||||
}
|
||||
|
||||
hll_return(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
hll_deflib(ACXLoader) {
|
||||
hll_export(Load),
|
||||
hll_export(Release),
|
||||
hll_export(GetNumofLine),
|
||||
hll_export(GetNumofColumn),
|
||||
hll_export(GetDataInt),
|
||||
hll_export(GetDataString),
|
||||
hll_export(GetDataStruct)
|
||||
};
|
||||
HLL_LIBRARY(ACXLoader,
|
||||
HLL_EXPORT(Load, ACXLoader_Load),
|
||||
HLL_EXPORT(Release, ACXLoader_Release),
|
||||
HLL_EXPORT(GetNumofLine, ACXLoader_GetNumofLine),
|
||||
HLL_EXPORT(GetNumofColumn, ACXLoader_GetNumofColumn),
|
||||
HLL_EXPORT(GetDataInt, ACXLoader_GetDataInt),
|
||||
HLL_EXPORT(GetDataString, ACXLoader_GetDataString),
|
||||
HLL_EXPORT(GetDataStruct, ACXLoader_GetDataStruct));
|
||||
|
||||
+7
-12
@@ -16,16 +16,11 @@
|
||||
|
||||
#include "hll.h"
|
||||
|
||||
// int Init(imain_system pIMainSystem)
|
||||
hll_warn_unimplemented(AliceLogo, Init, 1);
|
||||
// void SetWaveNum(int nNum, int nWave)
|
||||
hll_warn_unimplemented(AliceLogo, SetWaveNum, 0);
|
||||
// void Run(int nType, int nLoopFlag)
|
||||
hll_warn_unimplemented(AliceLogo, Run, 0);
|
||||
HLL_WARN_UNIMPLEMENTED(1, int, AliceLogo, Init, void *imainsystem);
|
||||
HLL_WARN_UNIMPLEMENTED( , void, AliceLogo, SetWaveNum, int n, int wave);
|
||||
HLL_WARN_UNIMPLEMENTED( , void, AliceLogo, Run, int type, int loop_flag);
|
||||
|
||||
hll_deflib(AliceLogo) {
|
||||
hll_export(Init),
|
||||
hll_export(SetWaveNum),
|
||||
hll_export(Run),
|
||||
NULL
|
||||
};
|
||||
HLL_LIBRARY(AliceLogo,
|
||||
HLL_EXPORT(Init, AliceLogo_Init),
|
||||
HLL_EXPORT(SetWaveNum, AliceLogo_SetWaveNum),
|
||||
HLL_EXPORT(Run, AliceLogo_Run));
|
||||
|
||||
+7
-12
@@ -16,16 +16,11 @@
|
||||
|
||||
#include "hll.h"
|
||||
|
||||
// int Init(imain_system pIMainSystem)
|
||||
hll_warn_unimplemented(AliceLogo2, Init, 1);
|
||||
// void SetWaveNum(int nNum, int nWave)
|
||||
hll_warn_unimplemented(AliceLogo2, SetWaveNum, 0);
|
||||
// void Run(int nType, int nLoopFlag)
|
||||
hll_warn_unimplemented(AliceLogo2, Run, 0);
|
||||
HLL_WARN_UNIMPLEMENTED(1, int, AliceLogo2, Init, void *imainsystem);
|
||||
HLL_WARN_UNIMPLEMENTED( , void, AliceLogo2, SetWaveNum, int n, int wave);
|
||||
HLL_WARN_UNIMPLEMENTED( , void, AliceLogo2, Run, int type, int loop_flag);
|
||||
|
||||
hll_deflib(AliceLogo2) {
|
||||
hll_export(Init),
|
||||
hll_export(SetWaveNum),
|
||||
hll_export(Run),
|
||||
NULL
|
||||
};
|
||||
HLL_LIBRARY(AliceLogo2,
|
||||
HLL_EXPORT(Init, AliceLogo2_Init),
|
||||
HLL_EXPORT(SetWaveNum, AliceLogo2_SetWaveNum),
|
||||
HLL_EXPORT(Run, AliceLogo2_Run));
|
||||
|
||||
+7
-12
@@ -16,16 +16,11 @@
|
||||
|
||||
#include "hll.h"
|
||||
|
||||
// int Init(imain_system pIMainSystem)
|
||||
hll_warn_unimplemented(AliceLogo3, Init, 1);
|
||||
// void SetWaveNum(int nNum, int nWave)
|
||||
hll_warn_unimplemented(AliceLogo3, SetWaveNum, 0);
|
||||
// void Run(int nType, int nLoopFlag)
|
||||
hll_warn_unimplemented(AliceLogo3, Run, 0);
|
||||
HLL_WARN_UNIMPLEMENTED(1, int, AliceLogo3, Init, void *imainsystem);
|
||||
HLL_WARN_UNIMPLEMENTED( , void, AliceLogo3, SetWaveNum, int n, int wave);
|
||||
HLL_WARN_UNIMPLEMENTED( , void, AliceLogo3, Run, int type, int loop_flag);
|
||||
|
||||
hll_deflib(AliceLogo3) {
|
||||
hll_export(Init),
|
||||
hll_export(SetWaveNum),
|
||||
hll_export(Run),
|
||||
NULL
|
||||
};
|
||||
HLL_LIBRARY(AliceLogo3,
|
||||
HLL_EXPORT(Init, AliceLogo3_Init),
|
||||
HLL_EXPORT(SetWaveNum, AliceLogo3_SetWaveNum),
|
||||
HLL_EXPORT(Run, AliceLogo3_Run));
|
||||
|
||||
+9
-15
@@ -16,19 +16,13 @@
|
||||
|
||||
#include "hll.h"
|
||||
|
||||
// void Init(imain_system pIMainSystem)
|
||||
hll_warn_unimplemented(Confirm2, Init, 0);
|
||||
// int ExistKeyFile(string pIFileName, int nKeyNum)
|
||||
hll_warn_unimplemented(Confirm2, ExistKeyFile, 1);
|
||||
// int CheckProtectFile(string pIFileName, int nKeyNum)
|
||||
hll_unimplemented(Confirm2, CheckProtectFile);
|
||||
// int CreateKeyFile(string pIFileName, int nKeyNum)
|
||||
hll_unimplemented(Confirm2, CreateKeyFile);
|
||||
HLL_WARN_UNIMPLEMENTED( , void, Confirm2, Init, void *imainsystem);
|
||||
HLL_WARN_UNIMPLEMENTED(1, int, Confirm2, ExistKeyFile, struct string *filename, int keynum);
|
||||
HLL_UNIMPLEMENTED(int, Confirm2, CheckProtectFile, struct string *filename, int keynum);
|
||||
HLL_UNIMPLEMENTED(int, Confirm2, CreateKeyFile, struct string *filename, int keynum);
|
||||
|
||||
hll_deflib(Confirm2) {
|
||||
hll_export(Init),
|
||||
hll_export(ExistKeyFile),
|
||||
hll_export(CheckProtectFile),
|
||||
hll_export(CreateKeyFile),
|
||||
NULL
|
||||
};
|
||||
HLL_LIBRARY(Confirm2,
|
||||
HLL_EXPORT(Init, Confirm2_Init),
|
||||
HLL_EXPORT(ExistKeyFile, Confirm2_ExistKeyFile),
|
||||
HLL_EXPORT(CheckProtectFile, Confirm2_CheckProtectFile),
|
||||
HLL_EXPORT(CreateKeyFile, Confirm2_CreateKeyFile));
|
||||
|
||||
+281
-291
@@ -21,298 +21,288 @@
|
||||
|
||||
#define TEX(sp_no) sact_get_texture(sp_no)
|
||||
|
||||
//void Copy(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_defun_inline(Copy, (gfx_copy(TEX(a[0].i), a[1].i, a[2].i, TEX(a[3].i), a[4].i, a[5].i, a[6].i, a[7].i), 0));
|
||||
//void CopyBright(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nRate)
|
||||
hll_defun_inline(CopyBright, (gfx_copy_bright(TEX(a[0].i), a[1].i, a[2].i, TEX(a[3].i), a[4].i, a[5].i, a[6].i, a[7].i, a[8].i), 0));
|
||||
//void CopyAMap(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_defun_inline(CopyAMap, (gfx_copy_amap(TEX(a[0].i), a[1].i, a[2].i, TEX(a[3].i), a[4].i, a[5].i, a[6].i, a[7].i), 0));
|
||||
//void CopySprite(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nR, int nG, int nB)
|
||||
hll_defun_inline(CopySprite, (gfx_copy_sprite(TEX(a[0].i), a[1].i, a[2].i, TEX(a[3].i), a[4].i, a[5].i, a[6].i, a[7].i, COLOR(a[8].i, a[9].i, a[10].i, 0)), 0));
|
||||
//void CopyColorReverse(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_unimplemented(DrawGraph, CopyColorReverse);
|
||||
//void CopyUseAMapUnder(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nAlpha)
|
||||
hll_defun_inline(CopyUseAMapUnder, (gfx_copy_use_amap_under(TEX(a[0].i), a[1].i, a[2].i, TEX(a[3].i), a[4].i, a[5].i, a[6].i, a[7].i, a[8].i), 0));
|
||||
//void CopyUseAMapBorder(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nAlpha)
|
||||
hll_defun_inline(CopyUseAMapBorder, (gfx_copy_use_amap_border(TEX(a[0].i), a[1].i, a[2].i, TEX(a[3].i), a[4].i, a[5].i, a[6].i, a[7].i, a[8].i), 0));
|
||||
//void CopyAMapMax(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_defun_inline(CopyAMapMax, (gfx_copy_amap_max(TEX(a[0].i), a[1].i, a[2].i, TEX(a[3].i), a[4].i, a[5].i, a[6].i, a[7].i), 0));
|
||||
//void CopyAMapMin(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_defun_inline(CopyAMapMin, (gfx_copy_amap_min(TEX(a[0].i), a[1].i, a[2].i, TEX(a[3].i), a[4].i, a[5].i, a[6].i, a[7].i), 0));
|
||||
//void Blend(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nAlpha)
|
||||
hll_unimplemented(DrawGraph, Blend);
|
||||
//void BlendSrcBright(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nAlpha, int nRate)
|
||||
hll_unimplemented(DrawGraph, BlendSrcBright);
|
||||
//void BlendAddSatur(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_unimplemented(DrawGraph, BlendAddSatur);
|
||||
//void BlendAMap(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_defun_inline(BlendAMap, (gfx_blend_amap(TEX(a[0].i), a[1].i, a[2].i, TEX(a[3].i), a[4].i, a[5].i, a[6].i, a[7].i), 0));
|
||||
//void BlendAMapSrcOnly(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_unimplemented(DrawGraph, BlendAMapSrcOnly);
|
||||
//void BlendAMapColor(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nR, int nG, int nB)
|
||||
hll_unimplemented(DrawGraph, BlendAMapColor);
|
||||
//void BlendAMapColorAlpha(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nR, int nG, int nB, int nAlpha)
|
||||
hll_unimplemented(DrawGraph, BlendAMapColorAlpha);
|
||||
//void BlendAMapAlpha(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nAlpha)
|
||||
hll_defun_inline(BlendAMapAlpha, (gfx_blend_amap_alpha(TEX(a[0].i), a[1].i, a[2].i, TEX(a[3].i), a[4].i, a[5].i, a[6].i, a[7].i, a[8].i), 0));
|
||||
//void BlendAMapBright(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nRate)
|
||||
hll_unimplemented(DrawGraph, BlendAMapBright);
|
||||
//void BlendAMapAlphaSrcBright(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nAlpha, int nRate)
|
||||
hll_unimplemented(DrawGraph, BlendAMapAlphaSrcBright);
|
||||
//void BlendUseAMapColor(int nDest, int nDx, int nDy, int nAlpha, int nAx, int nAy, int nWidth, int nHeight, int nR, int nG, int nB, int nRate)
|
||||
hll_unimplemented(DrawGraph, BlendUseAMapColor);
|
||||
//void BlendScreen(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_unimplemented(DrawGraph, BlendScreen);
|
||||
//void BlendMultiply(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_unimplemented(DrawGraph, BlendMultiply);
|
||||
//void BlendScreenAlpha(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nAlpha)
|
||||
hll_unimplemented(DrawGraph, BlendScreenAlpha);
|
||||
//void Fill(int nDest, int nX, int nY, int nWidth, int nHeight, int nR, int nG, int nB)
|
||||
hll_defun_inline(Fill, (gfx_fill(TEX(a[0].i), a[1].i, a[2].i, a[3].i, a[4].i, a[5].i, a[6].i, a[7].i), 0));
|
||||
//void FillAlphaColor(int nDest, int nX, int nY, int nWidth, int nHeight, int nR, int nG, int nB, int nRate)
|
||||
hll_defun_inline(FillAlphaColor, (gfx_fill_alpha_color(TEX(a[0].i), a[1].i, a[2].i, a[3].i, a[4].i, a[5].i, a[6].i, a[7].i, a[8].i), 0));
|
||||
//void FillAMap(int nDest, int nX, int nY, int nWidth, int nHeight, int nAlpha)
|
||||
hll_defun_inline(FillAMap, (gfx_fill_amap(TEX(a[0].i), a[1].i, a[2].i, a[3].i, a[4].i, a[5].i), 0));
|
||||
//void FillAMapOverBorder(int nDest, int nX, int nY, int nWidth, int nHeight, int nAlpha, int nBorder)
|
||||
hll_unimplemented(DrawGraph, FillAMapOverBorder);
|
||||
//void FillAMapUnderBorder(int nDest, int nX, int nY, int nWidth, int nHeight, int nAlpha, int nBorder)
|
||||
hll_unimplemented(DrawGraph, FillAMapUnderBorder);
|
||||
//void FillAMapGradationUD(int nDest, int nX, int nY, int nWidth, int nHeight, int nUpA, int nDownA)
|
||||
hll_unimplemented(DrawGraph, FillAMapGradationUD);
|
||||
//void FillScreen(int nDest, int nX, int nY, int nWidth, int nHeight, int nR, int nG, int nB)
|
||||
hll_unimplemented(DrawGraph, FillScreen);
|
||||
//void FillMultiply(int nDest, int nX, int nY, int nWidth, int nHeight, int nR, int nG, int nB)
|
||||
hll_unimplemented(DrawGraph, FillMultiply);
|
||||
//void SaturDP_DPxSA(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_unimplemented(DrawGraph, SaturDP);
|
||||
//void ScreenDA_DAxSA(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_unimplemented(DrawGraph, ScreenDA_DAxSA);
|
||||
//void AddDA_DAxSA(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_defun_inline(AddDA_DAxSA, (gfx_add_da_daxsa(TEX(a[0].i), a[1].i, a[2].i, TEX(a[3].i), a[4].i, a[5].i, a[6].i, a[7].i), 0));
|
||||
//void SpriteCopyAMap(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nColorKey)
|
||||
hll_unimplemented(DrawGraph, SpriteCopyAMap);
|
||||
//void BlendDA_DAxSA(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_unimplemented(DrawGraph, BlendDA);
|
||||
//void SubDA_DAxSA(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_unimplemented(DrawGraph, SubDA);
|
||||
//void BrightDestOnly(int nDest, int nX, int nY, int nWidth, int nHeight, int nRate)
|
||||
hll_unimplemented(DrawGraph, BrightDestOnly);
|
||||
//void CopyTextureWrap(int nDest, int nDx, int nDy, int nDWidth, int nDHeight, int nSrc, int nSx, int nSy, int nSWidth, int nSHeight, int nU, int nV)
|
||||
hll_unimplemented(DrawGraph, CopyTextureWrap);
|
||||
//void CopyTextureWrapAlpha(int nDest, int nDx, int nDy, int nDWidth, int nDHeight, int nSrc, int nSx, int nSy, int nSWidth, int nSHeight, int nU, int nV, int nAlpha)
|
||||
hll_unimplemented(DrawGraph, CopyTextureWrapAlpha);
|
||||
//void CopyStretch(int nDest, int nDx, int nDy, int nDWidth, int nDHeight, int nSrc, int nSx, int nSy, int nSWidth, int nSHeight)
|
||||
hll_defun_inline(CopyStretch, (gfx_copy_stretch(TEX(a[0].i), a[1].i, a[2].i, a[3].i, a[4].i, TEX(a[5].i), a[6].i, a[7].i, a[8].i, a[9].i), 0));
|
||||
//void CopyStretchBlend(int nDest, int nDx, int nDy, int nDWidth, int nDHeight, int nSrc, int nSx, int nSy, int nSWidth, int nSHeight, int nAlpha)
|
||||
hll_unimplemented(DrawGraph, CopyStretchBlend);
|
||||
//void CopyStretchBlendAMap(int nDest, int nDx, int nDy, int nDWidth, int nDHeight, int nSrc, int nSx, int nSy, int nSWidth, int nSHeight)
|
||||
hll_unimplemented(DrawGraph, CopyStretchBlendAMap);
|
||||
//void CopyStretchAMap(int nDest, int nDx, int nDy, int nDWidth, int nDHeight, int nSrc, int nSx, int nSy, int nSWidth, int nSHeight)
|
||||
hll_defun_inline(CopyStretchAMap, (gfx_copy_stretch_amap(TEX(a[0].i), a[1].i, a[2].i, a[3].i, a[4].i, TEX(a[5].i), a[6].i, a[7].i, a[8].i, a[9].i), 0));
|
||||
//void CopyStretchInterp(int nDest, int nDx, int nDy, int nDWidth, int nDHeight, int nSrc, int nSx, int nSy, int nSWidth, int nSHeight)
|
||||
hll_unimplemented(DrawGraph, CopyStretchInterp);
|
||||
//void CopyStretchAMapInterp(int nDest, int nDx, int nDy, int nDWidth, int nDHeight, int nSrc, int nSx, int nSy, int nSWidth, int nSHeight)
|
||||
hll_unimplemented(DrawGraph, CopyStretchAMapInterp);
|
||||
//void CopyReduce(int nDest, int nDx, int nDy, int nDWidth, int nDHeight, int nSrc, int nSx, int nSy, int nSWidth, int nSHeight)
|
||||
hll_defun_inline(CopyReduce, (gfx_copy_stretch(TEX(a[0].i), a[1].i, a[2].i, a[3].i, a[4].i, TEX(a[5].i), a[6].i, a[7].i, a[8].i, a[9].i), 0));
|
||||
//void CopyReduceAMap(int nDest, int nDx, int nDy, int nDWidth, int nDHeight, int nSrc, int nSx, int nSy, int nSWidth, int nSHeight)
|
||||
hll_defun_inline(CopyReduceAMap, (gfx_copy_stretch_amap(TEX(a[0].i), a[1].i, a[2].i, a[3].i, a[4].i, TEX(a[5].i), a[6].i, a[7].i, a[8].i, a[9].i), 0));
|
||||
//void DrawTextToPMap(int nDest, int nX, int nY, string szText)
|
||||
hll_defun_inline(DrawTextToPMap, (gfx_draw_text_to_pmap(TEX(a[0].i), a[1].i, a[2].i, hll_string_ref(a[3].i)->text), 0));
|
||||
//void DrawTextToAMap(int nDest, int nX, int nY, string szText)
|
||||
hll_defun_inline(DrawTextToAMap, (gfx_draw_text_to_amap(TEX(a[0].i), a[1].i, a[2].i, hll_string_ref(a[3].i)->text), 0));
|
||||
//void SetFontSize(int nSize)
|
||||
hll_defun_inline(SetFontSize, gfx_set_font_size(a[0].i));
|
||||
//void SetFontName(string pIText)
|
||||
hll_warn_unimplemented(DrawGraph, SetFontName, 0);
|
||||
//void SetFontWeight(int nWeight)
|
||||
hll_defun_inline(SetFontWeight, gfx_set_font_weight(a[0].i));
|
||||
//void SetFontUnderline(int nFlag)
|
||||
hll_defun_inline(SetFontUnderline, gfx_set_font_underline(a[0].i));
|
||||
//void SetFontStrikeOut(int nFlag)
|
||||
hll_defun_inline(SetFontStrikeOut, gfx_set_font_strikeout(a[0].i));
|
||||
//void SetFontSpace(int nSpace)
|
||||
hll_defun_inline(SetFontSpace, gfx_set_font_space(a[0].i));
|
||||
//void SetFontColor(int nR, int nG, int nB)
|
||||
hll_defun_inline(SetFontColor, gfx_set_font_color(COLOR(a[0].i, a[1].i, a[2].i, 255)));
|
||||
//int GetFontSize()
|
||||
hll_defun_inline(GetFontSize, gfx_get_font_size());
|
||||
//string GetFontName()
|
||||
hll_warn_unimplemented(DrawGraph, GetFontName, vm_string_ref(&EMPTY_STRING)); // FIXME
|
||||
//int GetFontWeight()
|
||||
hll_defun_inline(GetFontWeight, (int)gfx_get_font_weight());
|
||||
//int GetFontUnderline()
|
||||
hll_defun_inline(GetFontUnderline, gfx_get_font_underline());
|
||||
//int GetFontStrikeOut()
|
||||
hll_defun_inline(GetFontStrikeOut, gfx_get_font_strikeout());
|
||||
//int GetFontSpace()
|
||||
hll_defun_inline(GetFontSpace, gfx_get_font_space());
|
||||
|
||||
//void GetFontColor(ref int pnR, ref int pnG, ref int pnB)
|
||||
hll_defun(GetFontColor, args)
|
||||
void DrawGraph_Copy(int dst, int dx, int dy, int src, int sx, int sy, int w, int h)
|
||||
{
|
||||
SDL_Color c = gfx_get_font_color();
|
||||
*args[0].iref = c.r;
|
||||
*args[1].iref = c.g;
|
||||
*args[2].iref = c.b;
|
||||
hll_return(0);
|
||||
gfx_copy(TEX(dst), dx, dy, TEX(src), sx, sy, w, h);
|
||||
}
|
||||
|
||||
//void CopyRotZoom(int nDest, int nSrc, int nSx, int nSy, int nWidth, int nHeight, float fRotate, float fMag)
|
||||
hll_defun_inline(CopyRotZoom, (gfx_copy_rot_zoom(TEX(a[0].i), TEX(a[1].i), a[2].i, a[3].i, a[4].i, a[5].i, a[6].f, a[7].f), 0));
|
||||
//void CopyRotZoomAMap(int nDest, int nSrc, int nSx, int nSy, int nWidth, int nHeight, float fRotate, float fMag)
|
||||
hll_defun_inline(CopyRotZoomAMap, (gfx_copy_rot_zoom_amap(TEX(a[0].i), TEX(a[1].i), a[2].i, a[3].i, a[4].i, a[5].i, a[6].f, a[7].f), 0));
|
||||
//void CopyRotZoomUseAMap(int nDest, int nSrc, int nSx, int nSy, int nWidth, int nHeight, float fRotate, float fMag)
|
||||
hll_defun_inline(CopyRotZoomUseAMap, (gfx_copy_rot_zoom_use_amap(TEX(a[0].i), TEX(a[1].i), a[2].i, a[3].i, a[4].i, a[5].i, a[6].f, a[7].f), 0));
|
||||
//void CopyRotZoom2Bilinear(int nDest, float fCx, float fCy, int nSrc, float fSrcCx, float fSrcCy, float fRotate, float fMag)
|
||||
hll_unimplemented(DrawGraph, CopyRotZoom2Bilinear);
|
||||
//void CopyRotateY(int nWrite, int nDest, int nSrc, int nSx, int nSy, int nWidth, int nHeight, float fRotate, float fMag)
|
||||
hll_unimplemented(DrawGraph, CopyRotateY);
|
||||
//void CopyRotateYUseAMap(int nWrite, int nDest, int nSrc, int nSx, int nSy, int nWidth, int nHeight, float fRotate, float fMag)
|
||||
hll_unimplemented(DrawGraph, CopyRotateYUseAMap);
|
||||
//void CopyRotateYFixL(int nWrite, int nDest, int nSrc, int nSx, int nSy, int nWidth, int nHeight, float fRotate, float fMag)
|
||||
hll_unimplemented(DrawGraph, CopyRotateYFixL);
|
||||
//void CopyRotateYFixR(int nWrite, int nDest, int nSrc, int nSx, int nSy, int nWidth, int nHeight, float fRotate, float fMag)
|
||||
hll_unimplemented(DrawGraph, CopyRotateYFixR);
|
||||
//void CopyRotateYFixLUseAMap(int nWrite, int nDest, int nSrc, int nSx, int nSy, int nWidth, int nHeight, float fRotate, float fMag)
|
||||
hll_unimplemented(DrawGraph, CopyRotateYFixLUseAMap);
|
||||
//void CopyRotateYFixRUseAMap(int nWrite, int nDest, int nSrc, int nSx, int nSy, int nWidth, int nHeight, float fRotate, float fMag)
|
||||
hll_unimplemented(DrawGraph, CopyRotateYFixRUseAMap);
|
||||
//void CopyRotatex(int nWrite, int nDest, int nSrc, int nSx, int nSy, int nWidth, int nHeight, float fRotate, float fMag)
|
||||
hll_unimplemented(DrawGraph, CopyRotateX);
|
||||
//void CopyRotateXUseAMap(int nWrite, int nDest, int nSrc, int nSx, int nSy, int nWidth, int nHeight, float fRotate, float fMag)
|
||||
hll_unimplemented(DrawGraph, CopyRotateXUseAMap);
|
||||
//void CopyRotateXFixU(int nWrite, int nDest, int nSrc, int nSx, int nSy, int nWidth, int nHeight, float fRotate, float fMag)
|
||||
hll_unimplemented(DrawGraph, CopyRotateXFixU);
|
||||
//void CopyRotateXFixD(int nWrite, int nDest, int nSrc, int nSx, int nSy, int nWidth, int nHeight, float fRotate, float fMag)
|
||||
hll_unimplemented(DrawGraph, CopyRotateXFixD);
|
||||
//void CopyRotateXFixUUseAMap(int nWrite, int nDest, int nSrc, int nSx, int nSy, int nWidth, int nHeight, float fRotate, float fMag)
|
||||
hll_unimplemented(DrawGraph, CopyRotateXFixUUseAMap);
|
||||
//void CopyRotateXFixDUseAMap(int nWrite, int nDest, int nSrc, int nSx, int nSy, int nWidth, int nHeight, float fRotate, float fMag)
|
||||
hll_unimplemented(DrawGraph, CopyRotateXFixDUseAMap);
|
||||
//void CopyReverseLR(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_defun_inline(CopyReverseLR, (gfx_copy_reverse_LR(TEX(a[0].i), a[1].i, a[2].i, TEX(a[3].i), a[4].i, a[5].i, a[6].i, a[7].i), 0));
|
||||
//void CopyReverseUD(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_unimplemented(DrawGraph, CopyReverseUD);
|
||||
//void CopyReverseAMapLR(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_defun_inline(CopyReverseAMapLR, (gfx_copy_reverse_amap_LR(TEX(a[0].i), a[1].i, a[2].i, TEX(a[3].i), a[4].i, a[5].i, a[6].i, a[7].i), 0));
|
||||
//void CopyReverseAMapUD(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight)
|
||||
hll_unimplemented(DrawGraph, CopyReverseAMapUD);
|
||||
//void CopyWidthBlur(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nBlur)
|
||||
hll_unimplemented(DrawGraph, CopyWidthBlur);
|
||||
//void CopyHeightBlur(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nBlur)
|
||||
hll_unimplemented(DrawGraph, CopyHeightBlur);
|
||||
//void CopyAMapWidthBlur(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nBlur)
|
||||
hll_unimplemented(DrawGraph, CopyAMapWidthBlur);
|
||||
//void CopyAMapHeightBlur(int nDest, int nDx, int nDy, int nSrc, int nSx, int nSy, int nWidth, int nHeight, int nBlur)
|
||||
hll_unimplemented(DrawGraph, CopyAMapHeightBlur);
|
||||
//void DrawLine(int nDest, int nX0, int nY0, int nX1, int nY1, int nR, int nG, int nB)
|
||||
hll_unimplemented(DrawGraph, DrawLine);
|
||||
//void DrawLineToAMap(int nDest, int nX0, int nY0, int nX1, int nY1, int nAlpha)
|
||||
hll_unimplemented(DrawGraph, DrawLineToAMap);
|
||||
//bool GetPixelColor(int nSurface, int nX, int nY, ref int nR, ref int nG, ref int nB)
|
||||
hll_defun_inline(GetPixelColor, sact_SP_GetPixelValue(a[0].i, a[1].i, a[2].i, a[3].iref, a[4].iref, a[5].iref));
|
||||
//bool GetAlphaColor(int nSurface, int nX, int nY, ref int nA)
|
||||
hll_defun_inline(GetAlphaColor, (*a[3].iref = sact_SP_GetAMapValue(a[0].i, a[1].i, a[2].i), 1));
|
||||
//void DrawPolygon(int nDest, int nTex, float fX0, float fY0, float fZ0, float fU0, float fV0, float fX1, float fY1, float fZ1, float fU1, float fV1, float fX2, float fY2, float fZ2, float fU2, float fV2)
|
||||
hll_unimplemented(DrawGraph, DrawPolygon);
|
||||
//void DrawColorPolygon(int nDest, float fX0, float fY0, float fZ0, int nR0, int nG0, int nB0, int nA0, float fX1, float fY1, float fZ1, int nR1, int nG1, int nB1, int nA1, float fX2, float fY2, float fZ2, int nR2, int nG2, int nB2, int nA2)
|
||||
hll_unimplemented(DrawGraph, DrawColorPolygon);
|
||||
void DrawGraph_CopyBright(int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int rate)
|
||||
{
|
||||
gfx_copy_bright(TEX(dst), dx, dy, TEX(src), sx, sy, w, h, rate);
|
||||
}
|
||||
|
||||
hll_deflib(DrawGraph) {
|
||||
hll_export(Copy),
|
||||
hll_export(CopyBright),
|
||||
hll_export(CopyAMap),
|
||||
hll_export(CopySprite),
|
||||
hll_export(CopyColorReverse),
|
||||
hll_export(CopyUseAMapUnder),
|
||||
hll_export(CopyUseAMapBorder),
|
||||
hll_export(CopyAMapMax),
|
||||
hll_export(CopyAMapMin),
|
||||
hll_export(Blend),
|
||||
hll_export(BlendSrcBright),
|
||||
hll_export(BlendAddSatur),
|
||||
hll_export(BlendAMap),
|
||||
hll_export(BlendAMapSrcOnly),
|
||||
hll_export(BlendAMapColor),
|
||||
hll_export(BlendAMapColorAlpha),
|
||||
hll_export(BlendAMapAlpha),
|
||||
hll_export(BlendAMapBright),
|
||||
hll_export(BlendAMapAlphaSrcBright),
|
||||
hll_export(BlendUseAMapColor),
|
||||
hll_export(BlendScreen),
|
||||
hll_export(BlendMultiply),
|
||||
hll_export(BlendScreenAlpha),
|
||||
hll_export(Fill),
|
||||
hll_export(FillAlphaColor),
|
||||
hll_export(FillAMap),
|
||||
hll_export(FillAMapOverBorder),
|
||||
hll_export(FillAMapUnderBorder),
|
||||
hll_export(FillAMapGradationUD),
|
||||
hll_export(FillScreen),
|
||||
hll_export(FillMultiply),
|
||||
hll_export(SaturDP),
|
||||
hll_export(ScreenDA_DAxSA),
|
||||
hll_export(AddDA_DAxSA),
|
||||
hll_export(SpriteCopyAMap),
|
||||
hll_export(BlendDA),
|
||||
hll_export(SubDA),
|
||||
hll_export(BrightDestOnly),
|
||||
hll_export(CopyTextureWrap),
|
||||
hll_export(CopyTextureWrapAlpha),
|
||||
hll_export(CopyStretch),
|
||||
hll_export(CopyStretchBlend),
|
||||
hll_export(CopyStretchBlendAMap),
|
||||
hll_export(CopyStretchAMap),
|
||||
hll_export(CopyStretchInterp),
|
||||
hll_export(CopyStretchAMapInterp),
|
||||
hll_export(CopyReduce),
|
||||
hll_export(CopyReduceAMap),
|
||||
hll_export(DrawTextToPMap),
|
||||
hll_export(DrawTextToAMap),
|
||||
hll_export(SetFontSize),
|
||||
hll_export(SetFontName),
|
||||
hll_export(SetFontWeight),
|
||||
hll_export(SetFontUnderline),
|
||||
hll_export(SetFontStrikeOut),
|
||||
hll_export(SetFontSpace),
|
||||
hll_export(SetFontColor),
|
||||
hll_export(GetFontSize),
|
||||
hll_export(GetFontName),
|
||||
hll_export(GetFontWeight),
|
||||
hll_export(GetFontUnderline),
|
||||
hll_export(GetFontStrikeOut),
|
||||
hll_export(GetFontSpace),
|
||||
hll_export(GetFontColor),
|
||||
hll_export(CopyRotZoom),
|
||||
hll_export(CopyRotZoomAMap),
|
||||
hll_export(CopyRotZoomUseAMap),
|
||||
hll_export(CopyRotZoom2Bilinear),
|
||||
hll_export(CopyRotateY),
|
||||
hll_export(CopyRotateYUseAMap),
|
||||
hll_export(CopyRotateYFixL),
|
||||
hll_export(CopyRotateYFixR),
|
||||
hll_export(CopyRotateYFixLUseAMap),
|
||||
hll_export(CopyRotateYFixRUseAMap),
|
||||
hll_export(CopyRotateX),
|
||||
hll_export(CopyRotateXUseAMap),
|
||||
hll_export(CopyRotateXFixU),
|
||||
hll_export(CopyRotateXFixD),
|
||||
hll_export(CopyRotateXFixUUseAMap),
|
||||
hll_export(CopyRotateXFixDUseAMap),
|
||||
hll_export(CopyReverseLR),
|
||||
hll_export(CopyReverseUD),
|
||||
hll_export(CopyReverseAMapLR),
|
||||
hll_export(CopyReverseAMapUD),
|
||||
hll_export(CopyWidthBlur),
|
||||
hll_export(CopyHeightBlur),
|
||||
hll_export(CopyAMapWidthBlur),
|
||||
hll_export(CopyAMapHeightBlur),
|
||||
hll_export(DrawLine),
|
||||
hll_export(DrawLineToAMap),
|
||||
hll_export(GetPixelColor),
|
||||
hll_export(GetAlphaColor),
|
||||
hll_export(DrawPolygon),
|
||||
hll_export(DrawColorPolygon),
|
||||
NULL
|
||||
};
|
||||
void DrawGraph_CopyAMap(int dst, int dx, int dy, int src, int sx, int sy, int w, int h)
|
||||
{
|
||||
gfx_copy_amap(TEX(dst), dx, dy, TEX(src), sx, sy, w, h);
|
||||
}
|
||||
|
||||
void DrawGraph_CopySprite(int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int r, int g, int b)
|
||||
{
|
||||
gfx_copy_sprite(TEX(dst), dx, dy, TEX(src), sx, sy, w, h, COLOR(r, g, b, 0));
|
||||
}
|
||||
|
||||
void DrawGraph_CopyUseAMapUnder(int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int alpha)
|
||||
{
|
||||
gfx_copy_use_amap_under(TEX(dst), dx, dy, TEX(src), sx, sy, w, h, alpha);
|
||||
}
|
||||
|
||||
void DrawGraph_CopyUseAMapBorder(int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int alpha)
|
||||
{
|
||||
gfx_copy_use_amap_border(TEX(dst), dx, dy, TEX(src), sx, sy, w, h, alpha);
|
||||
}
|
||||
|
||||
void DrawGraph_CopyAMapMax(int dst, int dx, int dy, int src, int sx, int sy, int w, int h)
|
||||
{
|
||||
gfx_copy_amap_max(TEX(dst), dx, dy, TEX(src), sx, sy, w, h);
|
||||
}
|
||||
|
||||
void DrawGraph_CopyAMapMin(int dst, int dx, int dy, int src, int sx, int sy, int w, int h)
|
||||
{
|
||||
gfx_copy_amap_min(TEX(dst), dx, dy, TEX(src), sx, sy, w, h);
|
||||
}
|
||||
|
||||
void DrawGraph_BlendAMap(int dst, int dx, int dy, int src, int sx, int sy, int w, int h)
|
||||
{
|
||||
gfx_blend_amap(TEX(dst), dx, dy, TEX(src), sx, sy, w, h);
|
||||
}
|
||||
|
||||
void DrawGraph_BlendAMapAlpha(int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int alpha)
|
||||
{
|
||||
gfx_blend_amap_alpha(TEX(dst), dx, dy, TEX(src), sx, sy, w, h, alpha);
|
||||
}
|
||||
|
||||
void DrawGraph_Fill(int dst, int x, int y, int w, int h, int r, int g, int b)
|
||||
{
|
||||
gfx_fill(TEX(dst), x, y, w, h, r, g, b);
|
||||
}
|
||||
|
||||
void DrawGraph_FillAlphaColor(int dst, int x, int y, int w, int h, int r, int g, int b, int rate)
|
||||
{
|
||||
gfx_fill_alpha_color(TEX(dst), x, y, w, h, r, g, b, rate);
|
||||
}
|
||||
|
||||
void DrawGraph_FillAMap(int dst, int x, int y, int w, int h, int alpha)
|
||||
{
|
||||
gfx_fill_amap(TEX(dst), x, y, w, h, alpha);
|
||||
}
|
||||
|
||||
void DrawGraph_AddDA_DAxSA(int dst, int dx, int dy, int src, int sx, int sy, int w, int h)
|
||||
{
|
||||
gfx_add_da_daxsa(TEX(dst), dx, dy, TEX(src), sx, sy, w, h);
|
||||
}
|
||||
|
||||
void DrawGraph_CopyStretch(int dst, int dx, int dy, int dw, int dh, int src, int sx, int sy, int sw, int sh)
|
||||
{
|
||||
gfx_copy_stretch(TEX(dst), dx, dy, dw, dh, TEX(src), sx, sy, sw, sh);
|
||||
}
|
||||
|
||||
void DrawGraph_CopyStretchAMap(int dst, int dx, int dy, int dw, int dh, int src, int sx, int sy, int sw, int sh)
|
||||
{
|
||||
gfx_copy_stretch_amap(TEX(dst), dx, dy, dw, dh, TEX(src), sx, sy, sw, sh);
|
||||
}
|
||||
|
||||
void DrawGraph_DrawTextToPMap(int dst, int x, int y, struct string *s)
|
||||
{
|
||||
gfx_draw_text_to_pmap(TEX(dst), x, y, s->text);
|
||||
}
|
||||
|
||||
void DrawGraph_DrawTextToAMap(int dst, int x, int y, struct string *s)
|
||||
{
|
||||
gfx_draw_text_to_amap(TEX(dst), x, y, s->text);
|
||||
}
|
||||
|
||||
void DrawGraph_SetFontColor(int r, int g, int b)
|
||||
{
|
||||
gfx_set_font_color(COLOR(r, g, b, 255));
|
||||
}
|
||||
|
||||
void DrawGraph_GetFontColor(int *r, int *g, int *b)
|
||||
{
|
||||
SDL_Color c = gfx_get_font_color();
|
||||
*r = c.r;
|
||||
*g = c.g;
|
||||
*b = c.b;
|
||||
}
|
||||
|
||||
void DrawGraph_CopyRotZoom(int dst, int src, int sx, int sy, int w, int h, float rotate, float mag)
|
||||
{
|
||||
gfx_copy_rot_zoom(TEX(dst), TEX(src), sx, sy, w, h, rotate, mag);
|
||||
}
|
||||
|
||||
void DrawGraph_CopyRotZoomAMap(int dst, int src, int sx, int sy, int w, int h, float rotate, float mag)
|
||||
{
|
||||
gfx_copy_rot_zoom_amap(TEX(dst), TEX(src), sx, sy, w, h, rotate, mag);
|
||||
}
|
||||
|
||||
void DrawGraph_CopyRotZoomUseAMap(int dst, int src, int sx, int sy, int w, int h, float rotate, float mag)
|
||||
{
|
||||
gfx_copy_rot_zoom_use_amap(TEX(dst), TEX(src), sx, sy, w, h, rotate, mag);
|
||||
}
|
||||
|
||||
void DrawGraph_CopyReverseLR(int dst, int dx, int dy, int src, int sx, int sy, int w, int h)
|
||||
{
|
||||
gfx_copy_reverse_LR(TEX(dst), dx, dy, TEX(src), sx, sy, w, h);
|
||||
}
|
||||
|
||||
void DrawGraph_CopyReverseAMapLR(int dst, int dx, int dy, int src, int sx, int sy, int w, int h)
|
||||
{
|
||||
gfx_copy_reverse_amap_LR(TEX(dst), dx, dy, TEX(src), sx, sy, w, h);
|
||||
}
|
||||
|
||||
bool DrawGraph_GetAlphaColor(int surface, int x, int y, int *a)
|
||||
{
|
||||
*a = sact_SP_GetAMapValue(surface, x, y);
|
||||
return true;
|
||||
}
|
||||
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyColorReverse, int dst, int dx, int dy, int src, int sx, int sy, int w, int h);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, Blend, int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int alpha);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, BlendSrcBright, int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int alpha, int rate);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, BlendAddSatur, int dst, int dx, int dy, int src, int sx, int sy, int w, int h);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, BlendAMapSrcOnly, int dst, int dx, int dy, int src, int sx, int sy, int w, int h);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, BlendAMapColor, int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int r, int g, int b);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, BlendAMapColorAlpha, int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int r, int g, int b, int a);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, BlendAMapBright, int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int rate);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, BlendAMapAlphaSrcBright, int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int alpha, int rate);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, BlendUseAMapColor, int dst, int dx, int dy, int alpha, int ax, int ay, int w, int h, int r, int g, int b, int rate);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, BlendScreen, int dst, int dx, int dy, int src, int sx, int sy, int w, int h);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, BlendMultiply, int dst, int dx, int dy, int src, int sx, int sy, int w, int h);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, BlendScreenAlpha, int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int alpha);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, FillAMapOverBorder, int dst, int x, int y, int w, int h, int alpha, int border);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, FillAMapUnderBorder, int dst, int x, int y, int w, int h, int alpha, int border);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, FillAMapGradationUD, int dst, int x, int y, int w, int h, int up_a, int down_a);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, FillScreen, int dst, int x, int y, int w, int h, int r, int g, int b);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, FillMultiply, int dst, int x, int y, int w, int h, int r, int g, int b);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, SaturDP_DPxSA, int dst, int dx, int dy, int src, int sx, int sy, int w, int h);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, ScreenDA_DAxSA, int dst, int dx, int dy, int src, int sx, int sy, int w, int h);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, SpriteCopyAMap, int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int key);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, BlendDA_DAxSA, int dst, int dx, int dy, int src, int sx, int sy, int w, int h);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, SubDA_DAxSA, int dst, int dx, int dy, int src, int sx, int sy, int w, int h);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, BrightDestOnly, int dst, int x, int y, int w, int h, int rate);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyTextureWrap, int dst, int dx, int dy, int dw, int dh, int src, int sx, int sy, int sw, int sh, int u, int v);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyTextureWrapAlpha, int dst, int dx, int dy, int dw, int dh, int src, int sx, int sy, int sw, int sh, int u, int v, int alpha);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyStretchBlend, int dst, int dx, int dy, int dw, int dh, int src, int sx, int sy, int sw, int sh, int alpha);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyStretchBlendAMap, int dst, int dx, int dy, int dw, int dh, int src, int sx, int sy, int sw, int sh);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyStretchInterp, int dst, int dx, int dy, int dw, int dh, int src, int sx, int sy, int sw, int sh);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyStretchAMapInterp, int dst, int dx, int dy, int dw, int dh, int src, int sx, int sy, int sw, int sh);
|
||||
HLL_WARN_UNIMPLEMENTED( , void, DrawGraph, SetFontName, struct string *text);
|
||||
HLL_WARN_UNIMPLEMENTED(&EMPTY_STRING, struct string*, DrawGraph, GetFontName, void);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyRotZoom2Bilinear, int dst, float cx, float cy, int src, float scx, float scy, float rot, float mag);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyRotateY, int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyRotateYUseAMap, int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyRotateYFixL, int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyRotateYFixR, int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyRotateYFixLUseAMap, int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyRotateYFixRUseAMap, int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyRotateX, int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyRotateXUseAMap, int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyRotateXFixU, int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyRotateXFixD, int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyRotateXFixUUseAMap, int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyRotateXFixDUseAMap, int write, int dst, int src, int sx, int sy, int w, int h, float rot, float mag);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyReverseUD, int dst, int dx, int dy, int src, int sx, int sy, int w, int h);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyReverseAMapUD, int dst, int dx, int dy, int src, int sx, int sy, int w, int h);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyWidthBlur, int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int blur);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyHeightBlur, int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int blur);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyAMapWidthBlur, int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int blur);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, CopyAMapHeightBlur, int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int blur);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, DrawLine, int dst, int x0, int y0, int x1, int y1, int r, int g, int b);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, DrawLineToAMap, int dst, int x0, int y0, int x1, int y1, int alpha);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, DrawPolygon, int dst, int tex, float x0, float y0, float z0, float u0, float v0, float x1, float y1, float z1, float u1, float v1, float x2, float y2, float z2, float u2, float v2);
|
||||
HLL_UNIMPLEMENTED(void, DrawGraph, DrawColorPolygon, int dst, int tex, float x0, float y0, float z0, int r0, int g0, int b0, int a0, float x1, float y1, float z1, int r1, int g1, int b1, int a1, float x2, float y2, float z2, int r2, int g2, int b2, int a2);
|
||||
|
||||
HLL_LIBRARY(DrawGraph,
|
||||
HLL_EXPORT(Copy, DrawGraph_Copy),
|
||||
HLL_EXPORT(CopyBright, DrawGraph_CopyBright),
|
||||
HLL_EXPORT(CopyAMap, DrawGraph_CopyAMap),
|
||||
HLL_EXPORT(CopySprite, DrawGraph_CopySprite),
|
||||
HLL_EXPORT(CopyColorReverse, DrawGraph_CopyColorReverse),
|
||||
HLL_EXPORT(CopyUseAMapUnder, DrawGraph_CopyUseAMapUnder),
|
||||
HLL_EXPORT(CopyUseAMapBorder, DrawGraph_CopyUseAMapBorder),
|
||||
HLL_EXPORT(CopyAMapMax, DrawGraph_CopyAMapMax),
|
||||
HLL_EXPORT(CopyAMapMin, DrawGraph_CopyAMapMin),
|
||||
HLL_EXPORT(Blend, DrawGraph_Blend),
|
||||
HLL_EXPORT(BlendSrcBright, DrawGraph_BlendSrcBright),
|
||||
HLL_EXPORT(BlendAddSatur, DrawGraph_BlendAddSatur),
|
||||
HLL_EXPORT(BlendAMap, DrawGraph_BlendAMap),
|
||||
HLL_EXPORT(BlendAMapSrcOnly, DrawGraph_BlendAMapSrcOnly),
|
||||
HLL_EXPORT(BlendAMapColor, DrawGraph_BlendAMapColor),
|
||||
HLL_EXPORT(BlendAMapColorAlpha, DrawGraph_BlendAMapColorAlpha),
|
||||
HLL_EXPORT(BlendAMapAlpha, DrawGraph_BlendAMapAlpha),
|
||||
HLL_EXPORT(BlendAMapBright, DrawGraph_BlendAMapBright),
|
||||
HLL_EXPORT(BlendAMapAlphaSrcBright, DrawGraph_BlendAMapAlphaSrcBright),
|
||||
HLL_EXPORT(BlendUseAMapColor, DrawGraph_BlendUseAMapColor),
|
||||
HLL_EXPORT(BlendScreen, DrawGraph_BlendScreen),
|
||||
HLL_EXPORT(BlendMultiply, DrawGraph_BlendMultiply),
|
||||
HLL_EXPORT(BlendScreenAlpha, DrawGraph_BlendScreenAlpha),
|
||||
HLL_EXPORT(Fill, DrawGraph_Fill),
|
||||
HLL_EXPORT(FillAlphaColor, DrawGraph_FillAlphaColor),
|
||||
HLL_EXPORT(FillAMap, DrawGraph_FillAMap),
|
||||
HLL_EXPORT(FillAMapOverBorder, DrawGraph_FillAMapOverBorder),
|
||||
HLL_EXPORT(FillAMapUnderBorder, DrawGraph_FillAMapUnderBorder),
|
||||
HLL_EXPORT(FillAMapGradationUD, DrawGraph_FillAMapGradationUD),
|
||||
HLL_EXPORT(FillScreen, DrawGraph_FillScreen),
|
||||
HLL_EXPORT(FillMultiply, DrawGraph_FillMultiply),
|
||||
HLL_EXPORT(SaturDP_DPxSA, DrawGraph_SaturDP_DPxSA),
|
||||
HLL_EXPORT(ScreenDA_DAxSA, DrawGraph_ScreenDA_DAxSA),
|
||||
HLL_EXPORT(AddDA_DAxSA, DrawGraph_AddDA_DAxSA),
|
||||
HLL_EXPORT(SpriteCopyAMap, DrawGraph_SpriteCopyAMap),
|
||||
HLL_EXPORT(BlendDA_DAxSA, DrawGraph_BlendDA_DAxSA),
|
||||
HLL_EXPORT(SubDA_DAxSA, DrawGraph_SubDA_DAxSA),
|
||||
HLL_EXPORT(BrightDestOnly, DrawGraph_BrightDestOnly),
|
||||
HLL_EXPORT(CopyTextureWrap, DrawGraph_CopyTextureWrap),
|
||||
HLL_EXPORT(CopyTextureWrapAlpha, DrawGraph_CopyTextureWrapAlpha),
|
||||
HLL_EXPORT(CopyStretch, DrawGraph_CopyStretch),
|
||||
HLL_EXPORT(CopyStretchBlend, DrawGraph_CopyStretchBlend),
|
||||
HLL_EXPORT(CopyStretchBlendAMap, DrawGraph_CopyStretchBlendAMap),
|
||||
HLL_EXPORT(CopyStretchAMap, DrawGraph_CopyStretchAMap),
|
||||
HLL_EXPORT(CopyStretchInterp, DrawGraph_CopyStretchInterp),
|
||||
HLL_EXPORT(CopyStretchAMapInterp, DrawGraph_CopyStretchAMapInterp),
|
||||
HLL_EXPORT(CopyReduce, DrawGraph_CopyStretch),
|
||||
HLL_EXPORT(CopyReduceAMap, DrawGraph_CopyStretchAMap),
|
||||
HLL_EXPORT(DrawTextToPMap, DrawGraph_DrawTextToPMap),
|
||||
HLL_EXPORT(DrawTextToAMap, DrawGraph_DrawTextToAMap),
|
||||
HLL_EXPORT(SetFontSize, gfx_set_font_size),
|
||||
HLL_EXPORT(SetFontName, DrawGraph_SetFontName),
|
||||
HLL_EXPORT(SetFontWeight, gfx_set_font_weight),
|
||||
HLL_EXPORT(SetFontUnderline, gfx_set_font_underline),
|
||||
HLL_EXPORT(SetFontStrikeOut, gfx_set_font_strikeout),
|
||||
HLL_EXPORT(SetFontSpace, gfx_set_font_space),
|
||||
HLL_EXPORT(SetFontColor, DrawGraph_SetFontColor),
|
||||
HLL_EXPORT(GetFontSize, gfx_get_font_size),
|
||||
HLL_EXPORT(GetFontName, DrawGraph_GetFontName),
|
||||
HLL_EXPORT(GetFontWeight, gfx_get_font_weight),
|
||||
HLL_EXPORT(GetFontUnderline, gfx_get_font_underline),
|
||||
HLL_EXPORT(GetFontStrikeOut, gfx_get_font_strikeout),
|
||||
HLL_EXPORT(GetFontSpace, gfx_get_font_space),
|
||||
HLL_EXPORT(GetFontColor, DrawGraph_GetFontColor),
|
||||
HLL_EXPORT(CopyRotZoom, DrawGraph_CopyRotZoom),
|
||||
HLL_EXPORT(CopyRotZoomAMap, DrawGraph_CopyRotZoomAMap),
|
||||
HLL_EXPORT(CopyRotZoomUseAMap, DrawGraph_CopyRotZoomUseAMap),
|
||||
HLL_EXPORT(CopyRotZoom2Bilinear, DrawGraph_CopyRotZoom2Bilinear),
|
||||
HLL_EXPORT(CopyRotateY, DrawGraph_CopyRotateY),
|
||||
HLL_EXPORT(CopyRotateYUseAMap, DrawGraph_CopyRotateYUseAMap),
|
||||
HLL_EXPORT(CopyRotateYFixL, DrawGraph_CopyRotateYFixL),
|
||||
HLL_EXPORT(CopyRotateYFixR, DrawGraph_CopyRotateYFixR),
|
||||
HLL_EXPORT(CopyRotateYFixLUseAMap, DrawGraph_CopyRotateYFixLUseAMap),
|
||||
HLL_EXPORT(CopyRotateYFixRUseAMap, DrawGraph_CopyRotateYFixRUseAMap),
|
||||
HLL_EXPORT(CopyRotateX, DrawGraph_CopyRotateX),
|
||||
HLL_EXPORT(CopyRotateXUseAMap, DrawGraph_CopyRotateXUseAMap),
|
||||
HLL_EXPORT(CopyRotateXFixU, DrawGraph_CopyRotateXFixU),
|
||||
HLL_EXPORT(CopyRotateXFixD, DrawGraph_CopyRotateXFixD),
|
||||
HLL_EXPORT(CopyRotateXFixUUseAMap, DrawGraph_CopyRotateXFixUUseAMap),
|
||||
HLL_EXPORT(CopyRotateXFixDUseAMap, DrawGraph_CopyRotateXFixDUseAMap),
|
||||
HLL_EXPORT(CopyReverseLR, DrawGraph_CopyReverseLR),
|
||||
HLL_EXPORT(CopyReverseUD, DrawGraph_CopyReverseUD),
|
||||
HLL_EXPORT(CopyReverseAMapLR, DrawGraph_CopyReverseAMapLR),
|
||||
HLL_EXPORT(CopyReverseAMapUD, DrawGraph_CopyReverseAMapUD),
|
||||
HLL_EXPORT(CopyWidthBlur, DrawGraph_CopyWidthBlur),
|
||||
HLL_EXPORT(CopyHeightBlur, DrawGraph_CopyHeightBlur),
|
||||
HLL_EXPORT(CopyAMapWidthBlur, DrawGraph_CopyAMapWidthBlur),
|
||||
HLL_EXPORT(CopyAMapHeightBlur, DrawGraph_CopyAMapHeightBlur),
|
||||
HLL_EXPORT(DrawLine, DrawGraph_DrawLine),
|
||||
HLL_EXPORT(DrawLineToAMap, DrawGraph_DrawLineToAMap),
|
||||
HLL_EXPORT(GetPixelColor, sact_SP_GetPixelValue),
|
||||
HLL_EXPORT(GetAlphaColor, DrawGraph_GetAlphaColor),
|
||||
HLL_EXPORT(DrawPolygon, DrawGraph_DrawPolygon),
|
||||
HLL_EXPORT(DrawColorPolygon, DrawGraph_DrawColorPolygon));
|
||||
|
||||
@@ -16,11 +16,9 @@
|
||||
|
||||
#include "hll.h"
|
||||
|
||||
hll_warn_unimplemented(DrawPluginManager, Load, 1);
|
||||
hll_warn_unimplemented(DrawPluginManager, IsLoad, 1);
|
||||
HLL_WARN_UNIMPLEMENTED(1, int, DrawPluginManager, Load, struct string *plugin_name);
|
||||
HLL_WARN_UNIMPLEMENTED(1, int, DrawPluginManager, IsLoad, struct string *plugin_name);
|
||||
|
||||
hll_deflib(DrawPluginManager) {
|
||||
hll_export(Load),
|
||||
hll_export(IsLoad),
|
||||
NULL
|
||||
};
|
||||
HLL_LIBRARY(DrawPluginManager,
|
||||
HLL_EXPORT(Load, DrawPluginManager_Load),
|
||||
HLL_EXPORT(IsLoad, DrawPluginManager_IsLoad));
|
||||
|
||||
+53
-65
@@ -26,41 +26,40 @@
|
||||
#include "system4.h"
|
||||
#include "system4/string.h"
|
||||
#include "vm/heap.h"
|
||||
#include "vm/page.h"
|
||||
|
||||
static FILE *current_file = NULL;
|
||||
static char *file_contents = NULL;
|
||||
static size_t file_size = 0;
|
||||
static size_t file_cursor = 0;
|
||||
|
||||
//int Open(string szName, int nType)
|
||||
hll_defun(Open, args)
|
||||
int File_Open(struct string *filename, int type)
|
||||
{
|
||||
const char *mode;
|
||||
if (args[1].i == 1) {
|
||||
if (type == 1) {
|
||||
mode = "r";
|
||||
} else if (args[1].i == 2) {
|
||||
} else if (type == 2) {
|
||||
mode = "w";
|
||||
} else {
|
||||
WARNING("Unknown mode in File.Open: %d", args[1].i);
|
||||
hll_return(0);
|
||||
WARNING("Unknown mode in File.Open: %d", type);
|
||||
return 0;
|
||||
}
|
||||
if (current_file) {
|
||||
WARNING("Previously opened file wasn't closed");
|
||||
fclose(current_file);
|
||||
}
|
||||
|
||||
char *path = unix_path(hll_string_ref(args[0].i)->text);
|
||||
char *path = unix_path(filename->text);
|
||||
current_file = fopen(path, mode);
|
||||
if (!current_file) {
|
||||
WARNING("Failed to open file '%s': %s", path, strerror(errno));
|
||||
}
|
||||
|
||||
free(path);
|
||||
hll_return(!!current_file);
|
||||
return !!current_file;
|
||||
}
|
||||
|
||||
//int Close()
|
||||
hll_defun(Close, args)
|
||||
int File_Close(void)
|
||||
{
|
||||
if (!current_file) {
|
||||
VM_ERROR("File.Close called, but no open file");
|
||||
@@ -72,13 +71,12 @@ hll_defun(Close, args)
|
||||
file_contents = NULL;
|
||||
file_size = 0;
|
||||
file_cursor = 0;
|
||||
hll_return(r);
|
||||
return r;
|
||||
}
|
||||
|
||||
//int Read(ref struct pIVMStruct)
|
||||
hll_defun(Read, args)
|
||||
int File_Read(struct page **_page)
|
||||
{
|
||||
struct page *page = heap_get_page(args[0].i);
|
||||
struct page *page = *_page;
|
||||
if (page->type != STRUCT_PAGE) {
|
||||
VM_ERROR("File.Read of non-struct");
|
||||
}
|
||||
@@ -97,7 +95,7 @@ hll_defun(Read, args)
|
||||
if (fread(file_contents, file_size, 1, current_file) != 1) {
|
||||
WARNING("File.Read failed (fread): %s", strerror(errno));
|
||||
free(file_contents);
|
||||
hll_return(0);
|
||||
return 0;
|
||||
}
|
||||
file_contents[file_size] = '\0';
|
||||
}
|
||||
@@ -106,81 +104,73 @@ hll_defun(Read, args)
|
||||
cJSON *json = cJSON_ParseWithOpts(file_contents+file_cursor, &end, false);
|
||||
if (!json) {
|
||||
WARNING("File.Read failed to parse JSON");
|
||||
hll_return(0);
|
||||
return 0;
|
||||
}
|
||||
if (!cJSON_IsArray(json)) {
|
||||
WARNING("File.Read incorrect type in parsed JSON");
|
||||
hll_return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
file_cursor = end - file_contents;
|
||||
|
||||
json_load_page(page, json);
|
||||
cJSON_Delete(json);
|
||||
hll_return(0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
//int Write(struct pIVMStruct)
|
||||
hll_defun(Write, args)
|
||||
int File_Write(struct page *page)
|
||||
{
|
||||
if (!current_file) {
|
||||
VM_ERROR("File.Write called, but no open file");
|
||||
hll_return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
cJSON *json = vm_value_to_json(AIN_STRUCT, args[0]);
|
||||
cJSON *json = page_to_json(page);
|
||||
char *str = cJSON_Print(json);
|
||||
cJSON_Delete(json);
|
||||
|
||||
if (fwrite(str, strlen(str), 1, current_file) != 1) {
|
||||
WARNING("File.Write failed (fwrite): %s", strerror(errno));
|
||||
free(str);
|
||||
hll_return(0);
|
||||
return 0;
|
||||
}
|
||||
fflush(current_file);
|
||||
|
||||
free(str);
|
||||
hll_return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
//int Copy(string szSrcName, string szDstName)
|
||||
hll_unimplemented(File, Copy);
|
||||
|
||||
//int Delete(string szName)
|
||||
hll_unimplemented(File, Delete);
|
||||
|
||||
/*
|
||||
|
||||
struct tagSaveDate {
|
||||
int m_nYear;
|
||||
int m_nMonth;
|
||||
int m_nDay;
|
||||
int m_nHour;
|
||||
int m_nMinute;
|
||||
int m_nSecond;
|
||||
int m_nDayOfWeek;
|
||||
};
|
||||
struct tagSaveDate {
|
||||
int m_nYear;
|
||||
int m_nMonth;
|
||||
int m_nDay;
|
||||
int m_nHour;
|
||||
int m_nMinute;
|
||||
int m_nSecond;
|
||||
int m_nDayOfWeek;
|
||||
};
|
||||
|
||||
*/
|
||||
|
||||
//int GetTime(string szName, ref struct pIVMStruct)
|
||||
hll_defun(GetTime, args)
|
||||
int File_GetTime(struct string *filename, struct page **page)
|
||||
{
|
||||
struct stat s;
|
||||
char *path = unix_path(hll_string_ref(args[0].i)->text);
|
||||
union vm_value *date = hll_struct_ref(args[1].i);
|
||||
char *path = unix_path(filename->text);
|
||||
union vm_value *date = (*page)->values;
|
||||
|
||||
if (stat(path, &s) < 0) {
|
||||
WARNING("stat failed: %s", strerror(errno));
|
||||
free(path);
|
||||
hll_return(0);
|
||||
return 0;
|
||||
}
|
||||
free(path);
|
||||
|
||||
struct tm *tm = localtime(&s.st_mtime);
|
||||
if (!tm) {
|
||||
WARNING("localtime failed: %s", strerror(errno));
|
||||
hll_return(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
date[0].i = tm->tm_year;
|
||||
@@ -191,26 +181,24 @@ hll_defun(GetTime, args)
|
||||
date[5].i = tm->tm_sec;
|
||||
date[6].i = tm->tm_wday;
|
||||
|
||||
hll_return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
//int SetFind(string szName)
|
||||
hll_unimplemented(File, SetFind);
|
||||
//int GetFind(ref string szName)
|
||||
hll_unimplemented(File, GetFind);
|
||||
//int MakeDirectory(string szName)
|
||||
hll_unimplemented(File, MakeDirectory);
|
||||
HLL_UNIMPLEMENTED(int, File, Copy, struct string *src, struct string *dst);
|
||||
HLL_UNIMPLEMENTED(int, File, Delete, struct string *name);
|
||||
HLL_UNIMPLEMENTED(int, File, SetFind, struct string *name);
|
||||
HLL_UNIMPLEMENTED(int, File, GetFind, struct string **name);
|
||||
HLL_UNIMPLEMENTED(int, File, MakeDirectory, struct string *name);
|
||||
|
||||
HLL_LIBRARY(File,
|
||||
HLL_EXPORT(Open, File_Open),
|
||||
HLL_EXPORT(Close, File_Close),
|
||||
HLL_EXPORT(Read, File_Read),
|
||||
HLL_EXPORT(Write, File_Write),
|
||||
HLL_EXPORT(File, File_Copy),
|
||||
HLL_EXPORT(File, File_Delete),
|
||||
HLL_EXPORT(GetTime, File_GetTime),
|
||||
HLL_EXPORT(File, File_SetFind),
|
||||
HLL_EXPORT(File, File_GetFind),
|
||||
HLL_EXPORT(File, File_MakeDirectory));
|
||||
|
||||
hll_deflib(File) {
|
||||
hll_export(Open),
|
||||
hll_export(Close),
|
||||
hll_export(Read),
|
||||
hll_export(Write),
|
||||
hll_export(Copy),
|
||||
hll_export(Delete),
|
||||
hll_export(GetTime),
|
||||
hll_export(SetFind),
|
||||
hll_export(GetFind),
|
||||
hll_export(MakeDirectory),
|
||||
NULL
|
||||
};
|
||||
|
||||
+49
-99
@@ -28,128 +28,78 @@ static inline float deg2rad(float deg)
|
||||
return deg * (M_PI / 180.0);
|
||||
}
|
||||
|
||||
hll_defun(Cos, args)
|
||||
float Math_Cos(float x)
|
||||
{
|
||||
hll_return(cosf(deg2rad(args[0].f)));
|
||||
return cosf(deg2rad(x));
|
||||
}
|
||||
|
||||
hll_defun(Sin, args)
|
||||
float Math_Sin(float x)
|
||||
{
|
||||
hll_return(sinf(deg2rad(args[0].f)));
|
||||
return sinf(deg2rad(x));
|
||||
}
|
||||
|
||||
hll_defun(Sqrt, args)
|
||||
int Math_Min(int a, int b)
|
||||
{
|
||||
hll_return(sqrtf(args[0].f));
|
||||
return a < b ? a : b;
|
||||
}
|
||||
|
||||
hll_defun(Atan, args)
|
||||
float Math_MinF(float a, float b)
|
||||
{
|
||||
hll_return(atanf(args[0].f));
|
||||
return a < b ? a : b;
|
||||
}
|
||||
|
||||
hll_defun(Atan2, args)
|
||||
int Math_Max(int a, int b)
|
||||
{
|
||||
hll_return(atan2f(args[0].f, args[1].f));
|
||||
return a > b ? a : b;
|
||||
}
|
||||
|
||||
hll_defun(Abs, args)
|
||||
float Math_MaxF(float a, float b)
|
||||
{
|
||||
hll_return(abs(args[0].i));
|
||||
return a > b ? a : b;
|
||||
}
|
||||
|
||||
hll_defun(AbsF, args)
|
||||
void Math_Swap(int *a, int *b)
|
||||
{
|
||||
hll_return(fabsf(args[0].f));
|
||||
int tmp = *a;
|
||||
*a = *b;
|
||||
*b = tmp;
|
||||
}
|
||||
|
||||
hll_defun(Pow, args)
|
||||
void Math_SwapF(float *a, float *b)
|
||||
{
|
||||
hll_return(powf(args[0].f, args[1].f));
|
||||
float tmp = *a;
|
||||
*a = *b;
|
||||
*b = tmp;
|
||||
}
|
||||
|
||||
hll_defun(SetSeed, args)
|
||||
{
|
||||
srand(args[0].i);
|
||||
hll_return(0);
|
||||
}
|
||||
HLL_UNIMPLEMENTED(void, Math, SetRandMode, int mode);
|
||||
HLL_UNIMPLEMENTED(float, Math, RandF, void);
|
||||
HLL_UNIMPLEMENTED(void, Math, RandTableInit, int num, int size);
|
||||
HLL_UNIMPLEMENTED(int, Math, RandTable, int num);
|
||||
HLL_UNIMPLEMENTED(void, Math, RandTable2Init, int num, struct page *array);
|
||||
HLL_UNIMPLEMENTED(int, Math, RandTable2, int num);
|
||||
|
||||
hll_unimplemented(Math, SetRandMode)
|
||||
HLL_LIBRARY(Math,
|
||||
HLL_EXPORT(Cos, Math_Cos),
|
||||
HLL_EXPORT(Sin, Math_Sin),
|
||||
HLL_EXPORT(Sqrt, sqrtf),
|
||||
HLL_EXPORT(Atan, atanf),
|
||||
HLL_EXPORT(Atan2, atan2f),
|
||||
HLL_EXPORT(Abs, abs),
|
||||
HLL_EXPORT(AbsF, fabsf),
|
||||
HLL_EXPORT(Pow, powf),
|
||||
HLL_EXPORT(SetSeed, srand),
|
||||
HLL_EXPORT(SetRandMode, Math_SetRandMode),
|
||||
HLL_EXPORT(Rand, rand),
|
||||
HLL_EXPORT(RandF, Math_RandF),
|
||||
HLL_EXPORT(RandTableInit, Math_RandTableInit),
|
||||
HLL_EXPORT(RandTable, Math_RandTable),
|
||||
HLL_EXPORT(RandTable2Init, Math_RandTable2Init),
|
||||
HLL_EXPORT(RandTable2, Math_RandTable2),
|
||||
HLL_EXPORT(Min, Math_Min),
|
||||
HLL_EXPORT(MinF, Math_MinF),
|
||||
HLL_EXPORT(Max, Math_Max),
|
||||
HLL_EXPORT(MaxF, Math_MaxF),
|
||||
HLL_EXPORT(Swap, Math_Swap),
|
||||
HLL_EXPORT(SwapF, Math_SwapF));
|
||||
|
||||
hll_defun(Rand, args)
|
||||
{
|
||||
hll_return(rand());
|
||||
}
|
||||
|
||||
// TODO
|
||||
hll_unimplemented(Math, RandF)
|
||||
hll_unimplemented(Math, RandTableInit)
|
||||
hll_unimplemented(Math, RandTable)
|
||||
hll_unimplemented(Math, RandTable2Init)
|
||||
hll_unimplemented(Math, RandTable2)
|
||||
|
||||
hll_defun(Min, args)
|
||||
{
|
||||
int a = args[0].i, b = args[1].i;
|
||||
hll_return(a < b ? a : b);
|
||||
}
|
||||
|
||||
hll_defun(MinF, args)
|
||||
{
|
||||
float a = args[0].f, b = args[1].f;
|
||||
hll_return(a < b ? a : b);
|
||||
}
|
||||
|
||||
hll_defun(Max, args)
|
||||
{
|
||||
int a = args[0].i, b = args[1].i;
|
||||
hll_return(a > b ? a : b);
|
||||
}
|
||||
|
||||
hll_defun(MaxF, args)
|
||||
{
|
||||
float a = args[0].f, b = args[1].f;
|
||||
hll_return(a > b ? a : b);
|
||||
}
|
||||
|
||||
hll_defun(Swap, args)
|
||||
{
|
||||
int tmp = *args[0].iref;
|
||||
*args[0].iref = *args[1].iref;
|
||||
*args[1].iref = tmp;
|
||||
hll_return(0);
|
||||
}
|
||||
|
||||
hll_defun(SwapF, args)
|
||||
{
|
||||
float tmp = *args[0].fref;
|
||||
*args[0].fref = *args[1].fref;
|
||||
*args[1].fref = tmp;
|
||||
hll_return(0);
|
||||
}
|
||||
|
||||
hll_deflib(Math) {
|
||||
hll_export(Cos),
|
||||
hll_export(Sin),
|
||||
hll_export(Sqrt),
|
||||
hll_export(Atan),
|
||||
hll_export(Atan2),
|
||||
hll_export(Abs),
|
||||
hll_export(AbsF),
|
||||
hll_export(Pow),
|
||||
hll_export(SetSeed),
|
||||
hll_export(SetRandMode),
|
||||
hll_export(Rand),
|
||||
hll_export(RandF),
|
||||
hll_export(RandTableInit),
|
||||
hll_export(RandTable),
|
||||
hll_export(RandTable2Init),
|
||||
hll_export(RandTable2),
|
||||
hll_export(Min),
|
||||
hll_export(MinF),
|
||||
hll_export(Max),
|
||||
hll_export(MaxF),
|
||||
hll_export(Swap),
|
||||
hll_export(SwapF),
|
||||
NULL
|
||||
};
|
||||
|
||||
+21
-23
@@ -16,27 +16,25 @@
|
||||
|
||||
#include "hll.h"
|
||||
|
||||
hll_warn_unimplemented(MsgLogManager, Numof, 0);
|
||||
hll_warn_unimplemented(MsgLogManager, AddInt, 0);
|
||||
hll_warn_unimplemented(MsgLogManager, AddString, 0);
|
||||
hll_warn_unimplemented(MsgLogManager, GetType, 0);
|
||||
hll_warn_unimplemented(MsgLogManager, GetInt, 0);
|
||||
hll_warn_unimplemented(MsgLogManager, GetString, 0);
|
||||
hll_warn_unimplemented(MsgLogManager, Save, 0);
|
||||
hll_warn_unimplemented(MsgLogManager, Load, 0);
|
||||
hll_warn_unimplemented(MsgLogManager, SetLineMax, 0);
|
||||
hll_warn_unimplemented(MsgLogManager, GetInterface, 0);
|
||||
HLL_WARN_UNIMPLEMENTED(0, int, MsgLogManager, Numof, void);
|
||||
HLL_WARN_UNIMPLEMENTED( , void, MsgLogManager, AddInt, int type, int value);
|
||||
HLL_WARN_UNIMPLEMENTED( , void, MsgLogManager, AddString, int type, struct string *str);
|
||||
HLL_WARN_UNIMPLEMENTED(0, int, MsgLogManager, GetType, int index);
|
||||
HLL_WARN_UNIMPLEMENTED(0, int, MsgLogManager, GetInt, int index);
|
||||
HLL_WARN_UNIMPLEMENTED( , void, MsgLogManager, GetString, int index, struct string **str);
|
||||
HLL_WARN_UNIMPLEMENTED(0, int, MsgLogManager, Save, struct string *filename);
|
||||
HLL_WARN_UNIMPLEMENTED(0, int, MsgLogManager, Load, struct string *filename);
|
||||
HLL_WARN_UNIMPLEMENTED( , void, MsgLogManager, SetLineMax, int line_max);
|
||||
HLL_WARN_UNIMPLEMENTED(0, int, MsgLogManager, GetInterface, void);
|
||||
|
||||
hll_deflib(MsgLogManager) {
|
||||
hll_export(Numof),
|
||||
hll_export(AddInt),
|
||||
hll_export(AddString),
|
||||
hll_export(GetType),
|
||||
hll_export(GetInt),
|
||||
hll_export(GetString),
|
||||
hll_export(Save),
|
||||
hll_export(Load),
|
||||
hll_export(SetLineMax),
|
||||
hll_export(GetInterface),
|
||||
NULL
|
||||
};
|
||||
HLL_LIBRARY(MsgLogManager,
|
||||
HLL_EXPORT(Numof, MsgLogManager_Numof),
|
||||
HLL_EXPORT(AddInt, MsgLogManager_AddInt),
|
||||
HLL_EXPORT(AddString, MsgLogManager_AddString),
|
||||
HLL_EXPORT(GetType, MsgLogManager_GetType),
|
||||
HLL_EXPORT(GetInt, MsgLogManager_GetInt),
|
||||
HLL_EXPORT(GetString, MsgLogManager_GetString),
|
||||
HLL_EXPORT(Save, MsgLogManager_Save),
|
||||
HLL_EXPORT(Load, MsgLogManager_Load),
|
||||
HLL_EXPORT(SetLineMax, MsgLogManager_SetLineMax),
|
||||
HLL_EXPORT(GetInterface, MsgLogManager_GetInterface));
|
||||
|
||||
+32
-37
@@ -18,48 +18,43 @@
|
||||
#include "hll.h"
|
||||
|
||||
static bool enabled = false;
|
||||
//int Init(string szName)
|
||||
hll_warn_unimplemented(MsgSkip, Init, 1);
|
||||
//void UseFlag(int nUse)
|
||||
hll_warn_unimplemented(MsgSkip, UseFlag, 0);
|
||||
static int state = 0;
|
||||
|
||||
//void SetEnable(int nEnable)
|
||||
hll_defun(SetEnable, args)
|
||||
void MsgSkip_SetEnable(int enable)
|
||||
{
|
||||
enabled = !!args[0].i;
|
||||
hll_return(0);
|
||||
enabled = !!enable;
|
||||
}
|
||||
|
||||
//void SetState(int nState)
|
||||
hll_warn_unimplemented(MsgSkip, SetState, 0);
|
||||
//void SetFlag(int nMsgNum)
|
||||
hll_warn_unimplemented(MsgSkip, SetFlag, 0);
|
||||
|
||||
//int GetEnable(void)
|
||||
hll_defun(GetEnable, args)
|
||||
int MsgSkip_GetEnable(void)
|
||||
{
|
||||
hll_return(enabled);
|
||||
return enabled;
|
||||
}
|
||||
|
||||
//int GetState(void)
|
||||
hll_ignore_unimplemented(GetState, 0);
|
||||
//int GetFlag(int nMsgNum)
|
||||
hll_warn_unimplemented(MsgSkip, GetFlag, 0);
|
||||
//int GetNumofMsg(void)
|
||||
hll_warn_unimplemented(MsgSkip, GetNumofMsg, 0);
|
||||
//int GetNumofFlag(void)
|
||||
hll_warn_unimplemented(MsgSkip, GetNumofFlag, 0);
|
||||
void MsgSkip_SetState(int _state)
|
||||
{
|
||||
state = _state;
|
||||
}
|
||||
|
||||
hll_deflib(MsgSkip) {
|
||||
hll_export(Init),
|
||||
hll_export(UseFlag),
|
||||
hll_export(SetEnable),
|
||||
hll_export(SetState),
|
||||
hll_export(SetFlag),
|
||||
hll_export(GetEnable),
|
||||
hll_export(GetState),
|
||||
hll_export(GetFlag),
|
||||
hll_export(GetNumofMsg),
|
||||
hll_export(GetNumofFlag),
|
||||
NULL
|
||||
};
|
||||
int MsgSkip_GetState(void)
|
||||
{
|
||||
return state;
|
||||
}
|
||||
|
||||
HLL_WARN_UNIMPLEMENTED(1, int, MsgSkip, Init, struct string *name);
|
||||
HLL_WARN_UNIMPLEMENTED( , void, MsgSkip, UseFlag, int use);
|
||||
HLL_WARN_UNIMPLEMENTED( , void, MsgSkip, SetFlag, int msgnum);
|
||||
HLL_WARN_UNIMPLEMENTED(0, int, MsgSkip, GetFlag, int msgnum);
|
||||
HLL_WARN_UNIMPLEMENTED(0, int, MsgSkip, GetNumofMsg, void);
|
||||
HLL_WARN_UNIMPLEMENTED(0, int, MsgSkip, GetNumofFlag, void);
|
||||
|
||||
HLL_LIBRARY(MsgSkip,
|
||||
HLL_EXPORT(Init, MsgSkip_Init),
|
||||
HLL_EXPORT(UseFlag, MsgSkip_UseFlag),
|
||||
HLL_EXPORT(SetEnable, MsgSkip_SetEnable),
|
||||
HLL_EXPORT(SetState, MsgSkip_SetState),
|
||||
HLL_EXPORT(SetFlag, MsgSkip_SetFlag),
|
||||
HLL_EXPORT(GetEnable, MsgSkip_GetEnable),
|
||||
HLL_EXPORT(GetState, MsgSkip_GetState),
|
||||
HLL_EXPORT(GetFlag, MsgSkip_GetFlag),
|
||||
HLL_EXPORT(GetNumofMsg, MsgSkip_GetNumofMsg),
|
||||
HLL_EXPORT(GetNumofFlag, MsgSkip_GetNumofFlag));
|
||||
|
||||
+14
-18
@@ -19,27 +19,23 @@
|
||||
#include "system4/string.h"
|
||||
#include "system4/utfsjis.h"
|
||||
|
||||
hll_warn_unimplemented(OutputLog, Create, 0)
|
||||
|
||||
hll_defun(Output, args) {
|
||||
struct string *s = heap[args[1].i].s;
|
||||
void OutputLog_Output(int handle, struct string *s)
|
||||
{
|
||||
char *u = sjis2utf(s->text, s->size);
|
||||
printf("%s", u);
|
||||
free(u);
|
||||
hll_return(0);
|
||||
}
|
||||
|
||||
hll_warn_unimplemented(OutputLog, Clear, 0)
|
||||
hll_warn_unimplemented(OutputLog, Save, 0)
|
||||
hll_warn_unimplemented(OutputLog, EnableAutoSave, 0)
|
||||
hll_warn_unimplemented(OutputLog, DisableAutoSave, 0)
|
||||
HLL_WARN_UNIMPLEMENTED(0, int, OutputLog, Create, struct string *name);
|
||||
HLL_WARN_UNIMPLEMENTED( , void, OutputLog, Clear, int handle);
|
||||
HLL_WARN_UNIMPLEMENTED(0, int, OutputLog, Save, int handle, struct string *filename);
|
||||
HLL_WARN_UNIMPLEMENTED(0, bool, OutputLog, EnableAutoSave, int handle, struct string *filename);
|
||||
HLL_WARN_UNIMPLEMENTED(0, bool, OutputLog, DisableAutoSave, int handle);
|
||||
|
||||
hll_deflib(OutputLog) {
|
||||
hll_export(Create),
|
||||
hll_export(Output),
|
||||
hll_export(Clear),
|
||||
hll_export(Save),
|
||||
hll_export(EnableAutoSave),
|
||||
hll_export(DisableAutoSave),
|
||||
NULL
|
||||
};
|
||||
HLL_LIBRARY(OutputLog,
|
||||
HLL_EXPORT(Create, OutputLog_Create),
|
||||
HLL_EXPORT(Output, OutputLog_Output),
|
||||
HLL_EXPORT(Clear, OutputLog_Clear),
|
||||
HLL_EXPORT(Save, OutputLog_Save),
|
||||
HLL_EXPORT(EnableAutoSave, OutputLog_EnableAutoSave),
|
||||
HLL_EXPORT(DisableAutoSave, OutputLog_DisableAutoSave));
|
||||
|
||||
+13
-21
@@ -16,25 +16,17 @@
|
||||
|
||||
#include "hll.h"
|
||||
|
||||
// int Init()
|
||||
hll_warn_unimplemented(PlayMovie, Init, 0);
|
||||
// int Load(string pIFileName)
|
||||
hll_unimplemented(PlayMovie, Load);
|
||||
// int Play()
|
||||
hll_unimplemented(PlayMovie, Play);
|
||||
// void Stop()
|
||||
hll_unimplemented(PlayMovie, Stop);
|
||||
// int IsPlay()
|
||||
hll_unimplemented(PlayMovie, IsPlay);
|
||||
// void Release()
|
||||
hll_unimplemented(PlayMovie, Release);
|
||||
HLL_WARN_UNIMPLEMENTED(0, int, PlayMovie, Init, void);
|
||||
HLL_UNIMPLEMENTED(int, PlayMovie, Load, struct string *filename);
|
||||
HLL_UNIMPLEMENTED(int, PlayMovie, Play, void);
|
||||
HLL_UNIMPLEMENTED(void, PlayMovie, Stop, void);
|
||||
HLL_UNIMPLEMENTED(int, PlayMovie, IsPlay, void);
|
||||
HLL_UNIMPLEMENTED(void, PlayMovie, Release, void);
|
||||
|
||||
hll_deflib(PlayMovie) {
|
||||
hll_export(Init),
|
||||
hll_export(Load),
|
||||
hll_export(Play),
|
||||
hll_export(Stop),
|
||||
hll_export(IsPlay),
|
||||
hll_export(Release),
|
||||
NULL
|
||||
};
|
||||
HLL_LIBRARY(PlayMovie,
|
||||
HLL_EXPORT(Init, PlayMovie_Init),
|
||||
HLL_EXPORT(Load, PlayMovie_Load),
|
||||
HLL_EXPORT(Play, PlayMovie_Play),
|
||||
HLL_EXPORT(Stop, PlayMovie_Stop),
|
||||
HLL_EXPORT(IsPlay, PlayMovie_IsPlay),
|
||||
HLL_EXPORT(Release, PlayMovie_Release));
|
||||
|
||||
+357
-642
File diff suppressed because it is too large
Load Diff
+14
-24
@@ -17,29 +17,19 @@
|
||||
#include "hll.h"
|
||||
#include "gfx/gfx.h"
|
||||
|
||||
// int GetUpdateResult()
|
||||
hll_unimplemented(SystemServiceEx, GetUpdateResult);
|
||||
// int GetOverlayPresent()
|
||||
hll_warn_unimplemented(SystemServiceEx, GetOverlayPresent, 0);
|
||||
// int GetOverlayActive()
|
||||
hll_warn_unimplemented(SystemServiceEx, GetOverlayActive, 0);
|
||||
// void UpdateMainSurface(int nX, int nY, int nWidth, int nHeight)
|
||||
hll_unimplemented(SystemServiceEx, UpdateMainSurface);
|
||||
// void SetWaitVSync(int bWaitVSync)
|
||||
hll_defun_inline(SetWaitVSync, (gfx_set_wait_vsync(a[0].i), 0));
|
||||
// int GetHasPresented()
|
||||
hll_unimplemented(SystemServiceEx, GetHasPresented);
|
||||
// void ClearHasPresented()
|
||||
hll_unimplemented(SystemServiceEx, ClearHasPresented);
|
||||
HLL_UNIMPLEMENTED(int, SystemServiceEx, GetUpdateResult, void);
|
||||
HLL_WARN_UNIMPLEMENTED(0, int, SystemServiceEx, GetOverlayPresent, void);
|
||||
HLL_WARN_UNIMPLEMENTED(0, int, SystemServiceEx, GetOverlayActive, void);
|
||||
HLL_UNIMPLEMENTED(void, SystemServiceEx, UpdateMainSurface, int x, int y, int w, int h);
|
||||
HLL_UNIMPLEMENTED(int, SystemServiceEx, GetHasPresented, void);
|
||||
HLL_UNIMPLEMENTED(void, SystemServiceEx, ClearHasPresented, void);
|
||||
|
||||
hll_deflib(SystemServiceEx) {
|
||||
hll_export(GetUpdateResult),
|
||||
hll_export(GetOverlayPresent),
|
||||
hll_export(GetOverlayActive),
|
||||
hll_export(UpdateMainSurface),
|
||||
hll_export(SetWaitVSync),
|
||||
hll_export(GetHasPresented),
|
||||
hll_export(ClearHasPresented),
|
||||
NULL
|
||||
};
|
||||
HLL_LIBRARY(SystemServiceEx,
|
||||
HLL_EXPORT(GetUpdateResult, SystemServiceEx_GetUpdateResult),
|
||||
HLL_EXPORT(GetOverlayPresent, SystemServiceEx_GetOverlayPresent),
|
||||
HLL_EXPORT(GetOverlayActive, SystemServiceEx_GetOverlayActive),
|
||||
HLL_EXPORT(UpdateMainSurface, SystemServiceEx_UpdateMainSurface),
|
||||
HLL_EXPORT(SetWaitVSync, gfx_set_wait_vsync),
|
||||
HLL_EXPORT(GetHasPresented, SystemServiceEx_GetHasPresented),
|
||||
HLL_EXPORT(ClearHasPresented, SystemServiceEx_ClearHasPresented));
|
||||
|
||||
|
||||
+15
-57
@@ -22,70 +22,28 @@
|
||||
*/
|
||||
|
||||
#include "vm.h"
|
||||
#include "vm/heap.h"
|
||||
#include "vm/page.h"
|
||||
#include "system4.h"
|
||||
|
||||
#define hll_defun(fname, args) \
|
||||
static union vm_value _hllfun_ ## fname(possibly_unused union vm_value *args); \
|
||||
static struct static_hll_function _hllstruct_ ## fname = { \
|
||||
.name = #fname, \
|
||||
.fun = _hllfun_ ## fname \
|
||||
}; \
|
||||
static union vm_value _hllfun_ ## fname(possibly_unused union vm_value *args)
|
||||
|
||||
#define hll_defun_inline(fname, expr) \
|
||||
hll_defun(fname, a) { hll_return(expr); }
|
||||
|
||||
#define hll_unimplemented(libname, fname) \
|
||||
hll_defun(fname, args) { \
|
||||
#define HLL_UNIMPLEMENTED(rtype, libname, fname, ...) \
|
||||
static rtype libname ## _ ## fname(__VA_ARGS__) { \
|
||||
VM_ERROR("Unimplemented HLL function: " #libname "." #fname); \
|
||||
}
|
||||
|
||||
#define hll_unimplemented_warning(libname, fname) \
|
||||
WARNING("Unimplemented HLL function: " #libname "." #fname)
|
||||
|
||||
#define hll_warn_unimplemented(libname, fname, rval) \
|
||||
hll_defun(fname, args) { \
|
||||
hll_unimplemented_warning(libname, fname); \
|
||||
hll_return(rval); \
|
||||
#define HLL_WARN_UNIMPLEMENTED(rval, rtype, libname, fname, ...)\
|
||||
static rtype libname ## _ ## fname(__VA_ARGS__) { \
|
||||
WARNING("Unimplemented HLL function: " #libname "." #fname); \
|
||||
return rval; \
|
||||
}
|
||||
|
||||
#define hll_ignore_unimplemented(fname, rval) hll_defun_inline(fname, rval)
|
||||
#define HLL_EXPORT(fname, funptr) { .name = #fname, .fun = funptr }
|
||||
|
||||
#define hll_export(fname) &_hllstruct_ ## fname
|
||||
|
||||
#define hll_deflib(lname, ...) \
|
||||
static struct static_hll_function *_lib_ ## lname[]; \
|
||||
struct static_library lib_ ## lname = { \
|
||||
.name = #lname, \
|
||||
.functions = _lib_ ## lname \
|
||||
}; \
|
||||
static struct static_hll_function *_lib_ ## lname[] =
|
||||
|
||||
#define hll_return(v) return vm_value_cast(v)
|
||||
|
||||
static inline union vm_value *hll_struct_ref(int pageno)
|
||||
{
|
||||
if (pageno < 0 || heap[pageno].type != VM_PAGE || !heap[pageno].page || heap[pageno].page->type != STRUCT_PAGE)
|
||||
return NULL;
|
||||
return heap[pageno].page->values;
|
||||
}
|
||||
|
||||
static inline union vm_value *hll_array_ref(int pageno, int *size)
|
||||
{
|
||||
if (pageno < 0 || heap[pageno].type != VM_PAGE || !heap[pageno].page || heap[pageno].page->type != ARRAY_PAGE)
|
||||
return NULL;
|
||||
if (size)
|
||||
*size = heap[pageno].page->nr_vars;
|
||||
return heap[pageno].page->values;
|
||||
}
|
||||
|
||||
static inline struct string *hll_string_ref(int slot)
|
||||
{
|
||||
if (slot < 0 || heap[slot].type != VM_STRING)
|
||||
return NULL;
|
||||
return heap[slot].s;
|
||||
}
|
||||
#define HLL_LIBRARY(lname, ...) \
|
||||
struct static_library lib_ ## lname = { \
|
||||
.name = #lname, \
|
||||
.functions = { \
|
||||
__VA_ARGS__, \
|
||||
{ .name = NULL, .fun = NULL } \
|
||||
} \
|
||||
}
|
||||
|
||||
#endif /* SYSTEM4_HLL_H */
|
||||
|
||||
+2
-1
@@ -14,6 +14,7 @@ xsystem4 = ['audio.c',
|
||||
'cJSON.c',
|
||||
'draw.c',
|
||||
'effect.c',
|
||||
'ffi.c',
|
||||
'file.c',
|
||||
'format.c',
|
||||
'heap.c',
|
||||
@@ -45,7 +46,7 @@ xsystem4 = ['audio.c',
|
||||
'hll/SystemServiceEx.c',
|
||||
]
|
||||
|
||||
xsystem4_deps = [libm, zlib, sdl2, sdl2ttf, sdl2mixer, gl, glew]
|
||||
xsystem4_deps = [libm, zlib, sdl2, sdl2ttf, sdl2mixer, ffi, gl, glew]
|
||||
if chibi.found()
|
||||
xsystem4_deps += chibi
|
||||
xsystem4 += 'debugger.c'
|
||||
|
||||
+2
-2
@@ -54,7 +54,7 @@ static cJSON *value_to_json(union vm_value v)
|
||||
return cJSON_CreateNumber(v.li);
|
||||
}
|
||||
|
||||
static cJSON *page_to_json(struct page *page)
|
||||
static cJSON *resume_page_to_json(struct page *page)
|
||||
{
|
||||
if (!page)
|
||||
return cJSON_CreateNull();
|
||||
@@ -89,7 +89,7 @@ static cJSON *heap_to_json(void)
|
||||
cJSON_AddItemToArray(item, cJSON_CreateNumber(heap[i].ref));
|
||||
switch (heap[i].type) {
|
||||
case VM_PAGE:
|
||||
cJSON_AddItemToArray(item, page_to_json(heap[i].page));
|
||||
cJSON_AddItemToArray(item, resume_page_to_json(heap[i].page));
|
||||
break;
|
||||
case VM_STRING:
|
||||
cJSON_AddItemToArray(item, cJSON_CreateString(heap[i].s->text));
|
||||
|
||||
+202
-7
@@ -24,6 +24,7 @@
|
||||
#include "system4/string.h"
|
||||
#include "system4/utfsjis.h"
|
||||
#include "vm.h"
|
||||
#include "vm/page.h"
|
||||
|
||||
static struct sact_sprite *create_sprite(int sp_no, int width, int height, int r, int g, int b, int a);
|
||||
|
||||
@@ -99,7 +100,7 @@ static void realloc_sprite_table(int n)
|
||||
memset(sprites + old_nr_sprites, 0, sizeof(struct sact_sprite*) * (nr_sprites - old_nr_sprites));
|
||||
}
|
||||
|
||||
int sact_Init(void)
|
||||
int sact_Init(possibly_unused void *_, possibly_unused int cg_cache_size)
|
||||
{
|
||||
gfx_init();
|
||||
gfx_font_init();
|
||||
@@ -135,6 +136,27 @@ int sact_SetWP(int cg_no)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sact_SetWP_Color(int r, int g, int b)
|
||||
{
|
||||
gfx_set_clear_color(r, g, b, 255);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sact_GetScreenWidth(void)
|
||||
{
|
||||
return config.view_width;
|
||||
}
|
||||
|
||||
int sact_GetScreenHeight(void)
|
||||
{
|
||||
return config.view_height;
|
||||
}
|
||||
|
||||
int sact_GetMainSurfaceNumber(void)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
void sact_render_scene(void)
|
||||
{
|
||||
gfx_clear();
|
||||
@@ -184,12 +206,13 @@ int sact_SP_Count(void)
|
||||
return count;
|
||||
}
|
||||
|
||||
int sact_SP_Enum(union vm_value *array, int size)
|
||||
int sact_SP_Enum(struct page **array)
|
||||
{
|
||||
int count = 0;
|
||||
int size = (*array)->nr_vars;
|
||||
for (int i = 0; i < nr_sprites && count < size; i++) {
|
||||
if (sprites[i]) {
|
||||
array[count++].i = i;
|
||||
(*array)->values[count++].i = i;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
@@ -262,6 +285,31 @@ int sact_SP_Delete(int sp_no)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sact_SP_SetPos(int sp_no, int x, int y)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 1;
|
||||
sp->rect.x = x;
|
||||
sp->rect.y = y;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sact_SP_SetX(int sp_no, int x)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
sp->rect.x = x;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sact_SP_SetY(int sp_no, int y)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
sp->rect.y = y;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sact_SP_SetZ(int sp_no, int z)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
@@ -322,6 +370,11 @@ int sact_SP_GetDrawMethod(int sp_no)
|
||||
return t->draw_method;
|
||||
}
|
||||
|
||||
int sact_SP_IsUsing(int sp_no)
|
||||
{
|
||||
return sact_get_sprite(sp_no) != NULL;
|
||||
}
|
||||
|
||||
int sact_SP_ExistsAlpha(int sp_no)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
@@ -329,6 +382,80 @@ int sact_SP_ExistsAlpha(int sp_no)
|
||||
return sp->texture.has_alpha;
|
||||
}
|
||||
|
||||
int sact_SP_GetPosX(int sp_no)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
return sp->rect.x;
|
||||
}
|
||||
|
||||
int sact_SP_GetPosY(int sp_no)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
return sp->rect.y;
|
||||
}
|
||||
|
||||
int sact_SP_GetWidth(int sp_no)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
return sp->rect.w;
|
||||
}
|
||||
|
||||
int sact_SP_GetHeight(int sp_no)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
return sp->rect.h;
|
||||
}
|
||||
|
||||
int sact_SP_GetZ(int sp_no)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
return sp->z;
|
||||
}
|
||||
|
||||
int sact_SP_GetShow(int sp_no)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
return sp->show;
|
||||
}
|
||||
|
||||
int sact_SP_SetTextHome(int sp_no, int x, int y)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
sp->text.home = (Point) { .x = x, .y = y };
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sact_SP_SetTextLineSpace(int sp_no, int px)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 1;
|
||||
sp->text.line_space = px;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sact_SP_SetTextCharSpace(int sp_no, int px)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 1;
|
||||
sp->text.char_space = px;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sact_SP_SetTextPos(int sp_no, int x, int y)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
sp->text.pos = (Point) { .x = x, .y = y };
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void init_text_metrics(struct text_metrics *tm, union vm_value *_tm)
|
||||
{
|
||||
*tm = (struct text_metrics) {
|
||||
@@ -354,14 +481,14 @@ static void init_text_metrics(struct text_metrics *tm, union vm_value *_tm)
|
||||
};
|
||||
}
|
||||
|
||||
int sact_SP_TextDraw(int sp_no, struct string *text, union vm_value *_tm)
|
||||
int sact_SP_TextDraw(int sp_no, struct string *text, struct page *_tm)
|
||||
{
|
||||
|
||||
struct text_metrics tm;
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
|
||||
init_text_metrics(&tm, _tm);
|
||||
init_text_metrics(&tm, _tm->values);
|
||||
|
||||
if (!sp->text.texture.handle) {
|
||||
SDL_Color c;
|
||||
@@ -390,6 +517,23 @@ int sact_SP_TextClear(int sp_no)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sact_SP_TextHome(int sp_no, possibly_unused int size)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
// FIXME: do something with nTextSize
|
||||
sp->text.pos = sp->text.home;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sact_SP_TextNewLine(int sp_no, int size)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
sp->text.pos = POINT(sp->text.home.x, sp->text.home.y + size);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sact_SP_TextCopy(int dno, int sno)
|
||||
{
|
||||
struct sact_sprite *dsp = sact_get_sprite(dno);
|
||||
@@ -418,6 +562,48 @@ int sact_SP_TextCopy(int dno, int sno)
|
||||
return 1;
|
||||
}
|
||||
|
||||
int sact_SP_GetTextHomeX(int sp_no)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
return sp->text.home.x;
|
||||
}
|
||||
|
||||
int sact_SP_GetTextHomeY(int sp_no)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
return sp->text.home.y;
|
||||
}
|
||||
|
||||
int sact_SP_GetTextCharSpace(int sp_no)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
return sp->text.char_space;
|
||||
}
|
||||
|
||||
int sact_SP_GetTextPosX(int sp_no)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
return sp->text.pos.x;
|
||||
}
|
||||
|
||||
int sact_SP_GetTextPosY(int sp_no)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
return sp->text.pos.y;
|
||||
}
|
||||
|
||||
int sact_SP_GetTextLineSpace(int sp_no)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
if (!sp) return 0;
|
||||
return sp->text.line_space;
|
||||
}
|
||||
|
||||
int sact_SP_IsPtIn(int sp_no, int x, int y)
|
||||
{
|
||||
Point p = POINT(x, y);
|
||||
@@ -431,10 +617,19 @@ int sact_SP_IsPtIn(int sp_no, int x, int y)
|
||||
return !!c.a;
|
||||
}
|
||||
|
||||
int sact_CG_GetMetrics(int cg_no, union vm_value *cgm)
|
||||
int sact_SP_IsPtInRect(int sp_no, int x, int y)
|
||||
{
|
||||
struct sact_sprite *sp = sact_get_sprite(sp_no);
|
||||
Point p = { .x = x, .y = y };
|
||||
if (!sp) return 0;
|
||||
return !!SDL_PointInRect(&p, &sp->rect);
|
||||
}
|
||||
|
||||
int sact_CG_GetMetrics(int cg_no, struct page **page)
|
||||
{
|
||||
union vm_value *cgm = (*page)->values;
|
||||
struct cg_metrics metrics;
|
||||
if (!cg_get_metrics(ald[ALDFILE_CG], cg_no, &metrics))
|
||||
if (!cg_get_metrics(ald[ALDFILE_CG], cg_no - 1, &metrics))
|
||||
return 0;
|
||||
cgm[0].i = metrics.w;
|
||||
cgm[1].i = metrics.h;
|
||||
|
||||
+2
-3
@@ -36,9 +36,8 @@ static int current_global;
|
||||
free(str); \
|
||||
}
|
||||
|
||||
static cJSON *page_to_json(int index)
|
||||
cJSON *page_to_json(struct page *page)
|
||||
{
|
||||
struct page *page = heap_get_page(index);
|
||||
if (!page)
|
||||
return cJSON_CreateNull();
|
||||
|
||||
@@ -66,7 +65,7 @@ cJSON *vm_value_to_json(enum ain_data_type type, union vm_value val)
|
||||
return cJSON_CreateString(heap[val.i].s->text);
|
||||
case AIN_STRUCT:
|
||||
case AIN_ARRAY_TYPE:
|
||||
return page_to_json(val.i);
|
||||
return page_to_json(heap_get_page(val.i));
|
||||
case AIN_REF_TYPE:
|
||||
return cJSON_CreateNumber(-1);
|
||||
default:
|
||||
|
||||
@@ -235,6 +235,12 @@ void string_erase(struct string **s, int index)
|
||||
(*s)->text[(*s)->size] = '\0';
|
||||
}
|
||||
|
||||
void string_clear(struct string *s)
|
||||
{
|
||||
s->size = 0;
|
||||
s->text[0] = '\0';
|
||||
}
|
||||
|
||||
int string_find(const struct string *haystack, const struct string *needle)
|
||||
{
|
||||
int c = 0;
|
||||
|
||||
@@ -36,17 +36,10 @@
|
||||
#include "vm/page.h"
|
||||
|
||||
#define INITIAL_STACK_SIZE 4096
|
||||
#define HLL_MAX_ARGS 64
|
||||
|
||||
// When the IP is set to VM_RETURN, the VM halts
|
||||
#define VM_RETURN 0xFFFFFFFF
|
||||
|
||||
struct hll_function {
|
||||
union vm_value (*fun)(union vm_value *_args);
|
||||
};
|
||||
|
||||
static struct hll_function **libraries;
|
||||
|
||||
/*
|
||||
* NOTE: The current implementation is a simple bytecode interpreter.
|
||||
* System40.exe uses a JIT compiler, and we should too.
|
||||
@@ -314,50 +307,6 @@ void vm_call(int fno, int struct_page)
|
||||
instr_ptr = saved_ip;
|
||||
}
|
||||
|
||||
static void hll_call(int libno, int fno)
|
||||
{
|
||||
struct ain_hll_function *f = &ain->libraries[libno].functions[fno];
|
||||
|
||||
if (!libraries[libno])
|
||||
VM_ERROR("Unimplemented HLL function: %s.%s", ain->libraries[libno].name, f->name);
|
||||
|
||||
struct hll_function *fun = &libraries[libno][fno];
|
||||
if (!fun->fun)
|
||||
VM_ERROR("Unimplemented HLL function: %s.%s", ain->libraries[libno].name, f->name);
|
||||
|
||||
union vm_value args[HLL_MAX_ARGS];
|
||||
for (int i = f->nr_arguments - 1; i >= 0; i--) {
|
||||
int pageno, varno;
|
||||
switch(f->arguments[i].data_type) {
|
||||
case AIN_REF_INT:
|
||||
case AIN_REF_BOOL:
|
||||
case AIN_REF_FLOAT:
|
||||
stack_ptr -= 2;
|
||||
pageno = stack[stack_ptr].i;
|
||||
varno = stack[stack_ptr+1].i;
|
||||
args[i].ref = &heap[pageno].page->values[varno];
|
||||
break;
|
||||
default:
|
||||
stack_ptr--;
|
||||
args[i] = stack[stack_ptr];
|
||||
}
|
||||
}
|
||||
union vm_value r = fun->fun(args);
|
||||
for (int i = 0; i < f->nr_arguments; i++) {
|
||||
// XXX: We don't increase the ref count when passing ref arguments to HLL
|
||||
// functions, so we need to avoid decreasing it via variable_fini
|
||||
switch (f->arguments[i].data_type) {
|
||||
case AIN_REF_TYPE:
|
||||
break;
|
||||
default:
|
||||
variable_fini(stack[stack_ptr + i], f->arguments[i].data_type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (f->data_type != AIN_VOID)
|
||||
stack_push(r);
|
||||
}
|
||||
|
||||
static void function_return(void)
|
||||
{
|
||||
heap_unref(call_stack[call_stack_ptr-1].page_slot);
|
||||
@@ -1534,79 +1483,6 @@ static void vm_execute(void)
|
||||
}
|
||||
}
|
||||
|
||||
extern struct static_library lib_ACXLoader;
|
||||
extern struct static_library lib_AliceLogo;
|
||||
extern struct static_library lib_AliceLogo2;
|
||||
extern struct static_library lib_AliceLogo3;
|
||||
extern struct static_library lib_Confirm2;
|
||||
extern struct static_library lib_DrawGraph;
|
||||
extern struct static_library lib_DrawPluginManager;
|
||||
extern struct static_library lib_File;
|
||||
extern struct static_library lib_Math;
|
||||
extern struct static_library lib_MsgLogManager;
|
||||
extern struct static_library lib_MsgSkip;
|
||||
extern struct static_library lib_OutputLog;
|
||||
extern struct static_library lib_PlayMovie;
|
||||
extern struct static_library lib_SACT2;
|
||||
extern struct static_library lib_SystemServiceEx;
|
||||
|
||||
static struct static_library *static_libraries[] = {
|
||||
&lib_ACXLoader,
|
||||
&lib_AliceLogo,
|
||||
&lib_AliceLogo2,
|
||||
&lib_AliceLogo3,
|
||||
&lib_Confirm2,
|
||||
&lib_DrawGraph,
|
||||
&lib_DrawPluginManager,
|
||||
&lib_File,
|
||||
&lib_Math,
|
||||
&lib_MsgLogManager,
|
||||
&lib_MsgSkip,
|
||||
&lib_OutputLog,
|
||||
&lib_PlayMovie,
|
||||
&lib_SACT2,
|
||||
&lib_SystemServiceEx,
|
||||
NULL
|
||||
};
|
||||
|
||||
/*
|
||||
* "Link" a library that has been compiled into the xsystem4 executable.
|
||||
*/
|
||||
static struct hll_function *link_static_library(struct ain_library *ainlib, struct static_library *lib)
|
||||
{
|
||||
struct hll_function *dst = xcalloc(ainlib->nr_functions, sizeof(struct hll_function));
|
||||
|
||||
for (int i = 0; i < ainlib->nr_functions; i++) {
|
||||
for (int j = 0; lib->functions[j]; j++) {
|
||||
if (!strcmp(ainlib->functions[i].name, lib->functions[j]->name)) {
|
||||
dst[i].fun = lib->functions[j]->fun;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!dst[i].fun)
|
||||
WARNING("Unimplemented library function: %s", ainlib->functions[i].name);
|
||||
else if (ainlib->functions[i].nr_arguments >= HLL_MAX_ARGS)
|
||||
ERROR("Too many arguments to library function: %s", ainlib->functions[i].name);
|
||||
}
|
||||
return dst;
|
||||
}
|
||||
|
||||
static void link_libraries(void)
|
||||
{
|
||||
libraries = xcalloc(ain->nr_libraries, sizeof(struct hll_function*));
|
||||
|
||||
for (int i = 0; i < ain->nr_libraries; i++) {
|
||||
for (int j = 0; static_libraries[j]; j++) {
|
||||
if (!strcmp(ain->libraries[i].name, static_libraries[j]->name)) {
|
||||
libraries[i] = link_static_library(&ain->libraries[i], static_libraries[j]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!libraries[i])
|
||||
WARNING("Unimplemented library: %s", ain->libraries[i].name);
|
||||
}
|
||||
}
|
||||
|
||||
void vm_execute_ain(struct ain *program)
|
||||
{
|
||||
// initialize VM state
|
||||
|
||||
Reference in New Issue
Block a user