Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Libretro
RACE
Commits
04774942
Commit
04774942
authored
Oct 04, 2020
by
Libretro-Admin
Browse files
Convert libretro files to C
parent
a6afde4f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Makefile.common
View file @
04774942
...
...
@@ -36,13 +36,13 @@ endif
SOURCES_CXX
:=
\
$(CORE_DIR)
/tlcs900h.cpp
\
$(CORE_DIR)
/flash.cpp
\
$(CORE_DIR)
/graphics.cpp
\
$(CORE_DIR)
/libretro/libretro.cpp
\
$(CORE_DIR)
/libretro/log.cpp
$(CORE_DIR)
/graphics.cpp
SOURCES_C
+=
\
$(CORE_DIR)
/main.c
\
$(CORE_DIR)
/input.c
\
$(CORE_DIR)
/libretro/libretro.c
\
$(CORE_DIR)
/libretro/log.c
\
$(CORE_DIR)
/race-memory.c
\
$(CORE_DIR)
/ngpBios.c
\
$(CORE_DIR)
/state.c
\
...
...
flash.cpp
View file @
04774942
...
...
@@ -639,7 +639,7 @@ void flashChipWrite(unsigned int addr, unsigned char data)
}
/* this should be called when a ROM is unloaded */
void
flashShutdown
(
void
)
extern
"C"
void
flashShutdown
(
void
)
{
writeSaveGameFile
();
}
...
...
flash.h
View file @
04774942
...
...
@@ -27,13 +27,13 @@ void vectFlashWrite(unsigned char chip, unsigned int to,
unsigned
char
*
fromAddr
,
unsigned
int
numBytes
);
void
vectFlashErase
(
unsigned
char
chip
,
unsigned
char
blockNum
);
void
vectFlashChipErase
(
unsigned
char
chip
);
void
flashShutdown
(
void
);
#ifdef __cplusplus
extern
"C"
{
#endif
void
setFlashSize
(
unsigned
int
romSize
);
unsigned
char
flashReadInfo
(
unsigned
int
addr
);
void
flashShutdown
(
void
);
#ifdef __cplusplus
}
#endif
...
...
graphics.cpp
View file @
04774942
...
...
@@ -379,7 +379,7 @@ void palette_init16(DWORD dwRBitMask, DWORD dwGBitMask, DWORD dwBBitMask)
* Most interface functions seem to use camel case,
* so do the same here...
*/
void
graphicsSetDarkFilterLevel
(
unsigned
filterLevel
)
extern
"C"
void
graphicsSetDarkFilterLevel
(
unsigned
filterLevel
)
{
unsigned
prev_dark_filter_level
=
dark_filter_level
;
...
...
graphics.h
View file @
04774942
...
...
@@ -30,13 +30,13 @@
extern
"C"
{
#endif
BOOL
graphics_init
(
void
);
void
graphics_paint
(
void
);
void
graphicsSetDarkFilterLevel
(
unsigned
filterLevel
);
#ifdef __cplusplus
}
#endif
void
graphics_paint
(
void
);
/* new renderer (NeoGeo Pocket (Color)) */
void
myGraphicsBlitLine
(
unsigned
char
render
);
void
graphicsSetDarkFilterLevel
(
unsigned
filterLevel
);
/*
* adventure vision stuff
...
...
libretro/libretro.c
pp
→
libretro/libretro.c
View file @
04774942
...
...
@@ -38,7 +38,7 @@ static retro_input_state_t input_state_cb;
/* core options */
static
int
RETRO_SAMPLE_RATE
=
44100
;
ngp_screen
*
screen
;
struct
ngp_screen
*
screen
;
int
setting_ngp_language
;
/* 0x6F87 - language */
int
gfx_hacks
;
int
tipo_consola
;
/* 0x6F91 - OS version */
...
...
@@ -46,9 +46,13 @@ static bool libretro_supports_input_bitmasks;
char
retro_save_directory
[
2048
];
struct
map
{
unsigned
retro
;
unsigned
ngp
;
};
struct
map
{
unsigned
retro
;
unsigned
ngp
;
};
static
map
btn_map
[]
=
{
static
struct
map
btn_map
[]
=
{
{
RETRO_DEVICE_ID_JOYPAD_A
,
0x20
},
{
RETRO_DEVICE_ID_JOYPAD_B
,
0x10
},
{
RETRO_DEVICE_ID_JOYPAD_RIGHT
,
0x08
},
...
...
@@ -92,7 +96,7 @@ static void check_variables(void)
var
.
value
=
NULL
;
if
(
environ_cb
(
RETRO_ENVIRONMENT_GET_VARIABLE
,
&
var
)
&&
var
.
value
)
dark_filter_level
=
static_cast
<
unsigned
>
(
atoi
(
var
.
value
));
dark_filter_level
=
(
unsigned
)
(
atoi
(
var
.
value
));
graphicsSetDarkFilterLevel
(
dark_filter_level
);
}
void
retro_init
(
void
)
...
...
@@ -166,7 +170,7 @@ static unsigned get_race_input_bitmasks(void)
unsigned
i
=
0
;
unsigned
res
=
0
;
unsigned
ret
=
input_state_cb
(
0
,
RETRO_DEVICE_JOYPAD
,
0
,
RETRO_DEVICE_ID_JOYPAD_MASK
);
for
(
i
=
0
;
i
<
sizeof
(
btn_map
)
/
sizeof
(
map
);
i
++
)
for
(
i
=
0
;
i
<
sizeof
(
btn_map
)
/
sizeof
(
struct
map
);
i
++
)
res
|=
(
ret
&
(
1
<<
btn_map
[
i
].
retro
))
?
btn_map
[
i
].
ngp
:
0
;
return
res
;
}
...
...
@@ -175,7 +179,7 @@ static unsigned get_race_input(void)
{
unsigned
i
=
0
;
unsigned
res
=
0
;
for
(
i
=
0
;
i
<
sizeof
(
btn_map
)
/
sizeof
(
map
);
i
++
)
for
(
i
=
0
;
i
<
sizeof
(
btn_map
)
/
sizeof
(
struct
map
);
i
++
)
res
|=
input_state_cb
(
0
,
RETRO_DEVICE_JOYPAD
,
0
,
btn_map
[
i
].
retro
)
?
btn_map
[
i
].
ngp
:
0
;
return
res
;
}
...
...
@@ -208,9 +212,7 @@ static bool race_initialize_system(const char* gamepath)
return
true
;
}
void
retro_set_controller_port_device
(
unsigned
,
unsigned
)
{
}
void
retro_set_controller_port_device
(
unsigned
a
,
unsigned
b
)
{
}
void
retro_get_system_info
(
struct
retro_system_info
*
info
)
{
...
...
@@ -311,7 +313,7 @@ bool retro_load_game(const struct retro_game_info *info)
environ_cb
(
RETRO_ENVIRONMENT_SET_INPUT_DESCRIPTORS
,
desc
);
screen
=
(
ngp_screen
*
)
calloc
(
1
,
sizeof
(
*
screen
));
screen
=
(
struct
ngp_screen
*
)
calloc
(
1
,
sizeof
(
*
screen
));
if
(
!
screen
)
return
false
;
...
...
@@ -348,7 +350,7 @@ bool retro_load_game(const struct retro_game_info *info)
return
true
;
}
bool
retro_load_game_special
(
unsigned
,
const
struct
retro_game_info
*
,
size_t
)
bool
retro_load_game_special
(
unsigned
a
,
const
struct
retro_game_info
*
b
,
size_t
c
)
{
return
false
;
}
...
...
libretro/log.c
pp
→
libretro/log.c
View file @
04774942
File moved
libretro/log.h
View file @
04774942
...
...
@@ -3,8 +3,16 @@
#include "libretro.h"
#ifdef __cplusplus
extern
"C"
{
#endif
void
init_log
(
retro_environment_t
environ_cb
);
void
handle_error
(
const
char
*
error
);
void
handle_info
(
const
char
*
info
);
#endif
\ No newline at end of file
#ifdef __cplusplus
}
#endif
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment