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
tyrquake
Commits
58fecfb3
Unverified
Commit
58fecfb3
authored
Apr 02, 2020
by
Libretro-Admin
Committed by
GitHub
Apr 02, 2020
Browse files
Merge pull request #87 from phcoder/3ds
Fix 3ds support
parents
8c6ec56b
fc198131
Changes
20
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
58fecfb3
...
...
@@ -220,6 +220,7 @@ else ifeq ($(platform), ctr)
CFLAGS
+=
-march
=
armv6k
-mtune
=
mpcore
-mfloat-abi
=
hard
CFLAGS
+=
-Wall
-mword-relocations
CFLAGS
+=
-fomit-frame-pointer
-ffast-math
CFLAGS
+=
-I
$(DEVKITPRO)
/libctru/include
STATIC_LINKING
=
1
# Raspberry Pi 1
...
...
Makefile.common
View file @
58fecfb3
...
...
@@ -120,7 +120,11 @@ SOURCES_C += $(CORE_DIR)/common/net_dgrm.c \
$(CORE_DIR)
/common/net_udp.c
\
$(CORE_DIR)
/common/net_bsd.c
ifneq
($(STATIC_LINKING),1)
ifeq
($(platform), ctr)
SOURCES_C
+=
\
$(LIBRETRO_COMM_DIR)
/net/net_compat.c
\
$(LIBRETRO_COMM_DIR)
/net/net_socket.c
else
ifneq
($(STATIC_LINKING),1)
SOURCES_C
+=
\
$(LIBRETRO_COMM_DIR)
/net/net_compat.c
\
$(LIBRETRO_COMM_DIR)
/net/net_socket.c
...
...
QW/client/client.h
View file @
58fecfb3
...
...
@@ -144,7 +144,8 @@ typedef enum {
ca_demostart
,
// starting up a demo
ca_connected
,
// netchan_t established, waiting for svc_serverdata
ca_onserver
,
// processing data lists, donwloading, etc
ca_active
// everything is in, so frames can be rendered
ca_active
,
// everything is in, so frames can be rendered
ENSURE_INT_CACTIVE
=
0x70000000
}
cactive_t
;
typedef
enum
{
...
...
@@ -152,7 +153,8 @@ typedef enum {
dl_model
,
dl_sound
,
dl_skin
,
dl_single
dl_single
,
ENSURE_INT_DLTYPE
=
0x70000000
}
dltype_t
;
// download type
//
...
...
QW/server/server.h
View file @
58fecfb3
...
...
@@ -37,7 +37,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
typedef
enum
{
ss_dead
,
// no map loaded
ss_loading
,
// spawning level edicts
ss_active
// actively running
ss_active
,
// actively running
ENSURE_INT_SERVER_STATE
=
0x70000000
}
server_state_t
;
// some qc commands are only valid before the server has finished
...
...
@@ -108,7 +109,8 @@ typedef enum {
cs_zombie
,
// client has been disconnected, but don't reuse
// connection for a couple seconds
cs_connected
,
// has been assigned to a client_t, but not in game yet
cs_spawned
// client is fully in game
cs_spawned
,
// client is fully in game
ENSURE_INT_CLIENT_STATE
=
0x70000000
}
client_state_t
;
typedef
struct
{
...
...
@@ -429,7 +431,7 @@ void SV_SetMoveVars(void);
//
// svonly.c
//
typedef
enum
{
RD_NONE
,
RD_CLIENT
,
RD_PACKET
}
redirect_t
;
typedef
enum
{
RD_NONE
,
RD_CLIENT
,
RD_PACKET
,
ENSURE_INT_REDIRECT
=
0x70000000
}
redirect_t
;
void
SV_BeginRedirect
(
redirect_t
rd
);
void
SV_EndRedirect
(
void
);
...
...
common/bgmusic.c
View file @
58fecfb3
...
...
@@ -44,7 +44,8 @@ typedef enum _bgm_player
{
BGM_NONE
=
-
1
,
BGM_MIDIDRV
=
1
,
BGM_STREAMER
BGM_STREAMER
,
ENSURE_INT_BGMPLAYER
=
0x70000000
}
bgm_player_t
;
typedef
struct
music_handler_s
...
...
common/client.h
View file @
58fecfb3
...
...
@@ -92,7 +92,8 @@ typedef enum {
ca_disconnected
,
// full screen console with no connection
ca_connected
,
// valid netcon, doing signons...
ca_firstupdate
,
// waiting for first update (final signon stage)
ca_active
// signons complete, frames can be rendered
ca_active
,
// signons complete, frames can be rendered
ENSURE_INT_CACTIVE
=
0x70000000
}
cactive_t
;
//
...
...
common/cmd.h
View file @
58fecfb3
...
...
@@ -92,7 +92,8 @@ typedef struct stree_root *(*cmd_arg_f)(const char *);
typedef
enum
{
src_client
,
/* came in over a net connection as a clc_stringcmd
host_client will be valid during this state. */
src_command
/* from the command buffer */
src_command
,
/* from the command buffer */
ENSURE_INT_CMD_SOURCE
=
0x70000000
}
cmd_source_t
;
extern
cmd_source_t
cmd_source
;
...
...
common/d_iface.h
View file @
58fecfb3
...
...
@@ -43,7 +43,8 @@ typedef struct {
typedef
enum
{
pt_static
,
pt_grav
,
pt_slowgrav
,
pt_fire
,
pt_explode
,
pt_explode2
,
pt_blob
,
pt_blob2
pt_blob
,
pt_blob2
,
ENSURE_INT_PTYPE
=
0x70000000
}
ptype_t
;
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
...
...
common/keys.h
View file @
58fecfb3
...
...
@@ -272,7 +272,9 @@ typedef enum {
K_AUX30
,
K_AUX31
,
K_AUX32
,
K_LAST
K_LAST
,
ENSURE_INT_KNUM
=
0x70000000
}
knum_t
;
typedef
enum
{
...
...
@@ -280,7 +282,8 @@ typedef enum {
key_console
,
key_message
,
key_menu
,
key_none
key_none
,
ENSURE_INT_KEYDEST
=
0x70000000
}
keydest_t
;
extern
keydest_t
key_dest
;
...
...
common/libretro.c
View file @
58fecfb3
...
...
@@ -97,6 +97,12 @@ static bool libretro_supports_bitmasks = false;
#define SAMPLERATE 48000
#define MAX_AUDIO_BUFFER_SIZE (10240)
static
int16_t
audio_buffer
[
MAX_AUDIO_BUFFER_SIZE
];
static
int
audio_buffer_size
;
static
unsigned
audio_buffer_ptr
;
// System analog stick range is -0x8000 to 0x8000
#define ANALOG_RANGE 0x8000
// Default deadzone: 15%
...
...
@@ -210,7 +216,7 @@ gp_layout_t classic_alt = {
gp_layout_t
*
gp_layoutp
=
NULL
;
float
framerate
=
60
.
0
f
;
static
float
framerate
=
60
.
0
f
;
static
bool
initial_resolution_set
=
false
;
static
int
invert_y_axis
=
1
;
...
...
@@ -715,21 +721,29 @@ static void update_variables(bool startup)
var
.
key
=
"tyrquake_framerate"
;
var
.
value
=
NULL
;
if
(
startup
&&
environ_cb
(
RETRO_ENVIRONMENT_GET_VARIABLE
,
&
var
)
)
if
(
startup
)
{
if
(
!
strcmp
(
var
.
value
,
"auto"
))
{
float
target_framerate
=
0
.
0
f
;
if
(
!
environ_cb
(
RETRO_ENVIRONMENT_GET_TARGET_REFRESH_RATE
,
&
target_framerate
))
target_framerate
=
60
.
0
f
;
framerate
=
target_framerate
;
}
else
if
(
environ_cb
(
RETRO_ENVIRONMENT_GET_VARIABLE
,
&
var
))
{
if
(
!
strcmp
(
var
.
value
,
"auto"
))
{
float
target_framerate
=
0
.
0
f
;
if
(
!
environ_cb
(
RETRO_ENVIRONMENT_GET_TARGET_REFRESH_RATE
,
&
target_framerate
))
target_framerate
=
60
.
0
f
;
framerate
=
target_framerate
;
}
else
framerate
=
atof
(
var
.
value
);
}
else
framerate
=
60
.
0
f
;
if
(
framerate
>
49
.
0
)
audio_buffer_size
=
2048
;
else
audio_buffer_size
=
2
*
SAMPLERATE
/
framerate
;
if
(
audio_buffer_size
>
MAX_AUDIO_BUFFER_SIZE
)
audio_buffer_size
=
MAX_AUDIO_BUFFER_SIZE
;
}
else
framerate
=
60
.
0
f
;
var
.
key
=
"tyrquake_colored_lighting"
;
var
.
value
=
NULL
;
...
...
@@ -1227,7 +1241,7 @@ void VID_Update(vrect_t *rects)
uint16_t
*
pal
=
(
uint16_t
*
)
&
d_8to16table
;
uint16_t
*
ptr
=
(
uint16_t
*
)
finalimage
;
if
(
!
video_cb
||
!
rects
)
if
(
!
video_cb
||
!
rects
||
did_flip
)
return
;
for
(
y
=
0
;
y
<
rects
->
height
;
++
y
)
...
...
@@ -1266,11 +1280,6 @@ void D_EndDirectRect(int x, int y, int width, int height)
* SOUND (TODO)
*/
#define BUFFER_SIZE (2048)
static
int16_t
audio_buffer
[
BUFFER_SIZE
];
static
unsigned
audio_buffer_ptr
;
static
void
audio_process
(
void
)
{
/* adds music raw samples and/or advances midi driver */
...
...
@@ -1287,22 +1296,32 @@ static void audio_process(void)
CDAudio_Update
();
}
static
void
audio_batch_cb_blocking
(
int16_t
*
sa
,
size_t
sz
)
{
while
(
sz
)
{
size_t
r
=
audio_batch_cb
(
sa
,
sz
);
sz
-=
r
;
sa
+=
r
;
}
}
static
void
audio_callback
(
void
)
{
unsigned
read_first
,
read_second
;
float
samples_per_frame
=
(
2
*
SAMPLERATE
)
/
framerate
;
const
int
nchans
=
2
;
int
samples_per_frame
=
(
nchans
*
SAMPLERATE
)
/
framerate
;
unsigned
read_end
=
audio_buffer_ptr
+
samples_per_frame
;
if
(
read_end
>
BUFFER_SIZE
)
read_end
=
BUFFER_SIZE
;
if
(
read_end
>
audio_buffer_size
)
read_end
=
audio_buffer_size
;
read_first
=
read_end
-
audio_buffer_ptr
;
read_second
=
samples_per_frame
-
read_first
;
audio_batch_cb
(
audio_buffer
+
audio_buffer_ptr
,
read_first
/
(
shm
->
samplebits
/
8
)
);
audio_batch_cb
_blocking
(
audio_buffer
+
audio_buffer_ptr
,
read_first
/
nchans
);
audio_buffer_ptr
+=
read_first
;
if
(
read_second
>=
1
)
{
audio_batch_cb
(
audio_buffer
,
read_second
/
(
shm
->
samplebits
/
8
)
);
audio_batch_cb
_blocking
(
audio_buffer
,
read_second
/
nchans
);
audio_buffer_ptr
=
read_second
;
}
}
...
...
@@ -1315,7 +1334,7 @@ qboolean SNDDMA_Init(dma_t *dma)
shm
->
samplepos
=
0
;
shm
->
samplebits
=
16
;
shm
->
signed8
=
0
;
shm
->
samples
=
BUFFER_SIZE
;
shm
->
samples
=
audio_buffer_size
;
shm
->
buffer
=
(
unsigned
char
*
volatile
)
audio_buffer
;
return
true
;
...
...
common/libretro_core_options.h
View file @
58fecfb3
...
...
@@ -40,6 +40,7 @@ struct retro_core_option_definition option_defs_us[] = {
{
"360x400"
,
NULL
},
{
"360x480"
,
NULL
},
{
"400x224"
,
NULL
},
{
"400x240"
,
NULL
},
{
"480x272"
,
NULL
},
{
"512x224"
,
NULL
},
{
"512x240"
,
NULL
},
...
...
@@ -65,7 +66,11 @@ struct retro_core_option_definition option_defs_us[] = {
{
"1920x1200"
,
NULL
},
{
NULL
,
NULL
},
},
#ifdef _3DS
"400x240"
,
#else
"320x200"
#endif
},
{
"tyrquake_framerate"
,
...
...
@@ -73,6 +78,12 @@ struct retro_core_option_definition option_defs_us[] = {
"Modify framerate. Requires a restart."
,
{
{
"auto"
,
"Auto"
},
{
"10"
,
"10fps"
},
{
"15"
,
"15fps"
},
{
"20"
,
"20fps"
},
{
"25"
,
"25fps"
},
{
"30"
,
"30fps"
},
{
"40"
,
"40fps"
},
{
"50"
,
"50fps"
},
{
"60"
,
"60fps"
},
{
"72"
,
"72fps"
},
...
...
@@ -93,7 +104,11 @@ struct retro_core_option_definition option_defs_us[] = {
{
"360"
,
"360fps"
},
{
NULL
,
NULL
},
},
#ifdef _3DS
"25"
#else
"auto"
#endif
},
{
"tyrquake_colored_lighting"
,
...
...
common/model.h
View file @
58fecfb3
...
...
@@ -349,7 +349,7 @@ static INLINE sw_aliashdr_t *SW_Aliashdr(aliashdr_t *h)
// Whole model
//
typedef
enum
{
mod_brush
,
mod_sprite
,
mod_alias
}
modtype_t
;
typedef
enum
{
mod_brush
,
mod_sprite
,
mod_alias
,
ENSURE_INT_MODTYPE
=
0x70000000
}
modtype_t
;
#define EF_ROCKET 1 // leave a trail
#define EF_GRENADE 2 // leave a trail
...
...
common/modelgen.h
View file @
58fecfb3
...
...
@@ -40,12 +40,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// must match definition in spritegn.h
#ifndef SYNCTYPE_T
#define SYNCTYPE_T
typedef
enum
{
ST_SYNC
=
0
,
ST_RAND
}
synctype_t
;
typedef
enum
{
ST_SYNC
=
0
,
ST_RAND
,
ENSURE_INT_SYNCTYPE
=
0x70000000
}
synctype_t
;
#endif
typedef
enum
{
ALIAS_SINGLE
=
0
,
ALIAS_GROUP
}
aliasframetype_t
;
typedef
enum
{
ALIAS_SINGLE
=
0
,
ALIAS_GROUP
,
ENSURE_INT_ALIASFRAMETYPE
=
0x70000000
}
aliasframetype_t
;
typedef
enum
{
ALIAS_SKIN_SINGLE
=
0
,
ALIAS_SKIN_GROUP
}
aliasskintype_t
;
typedef
enum
{
ALIAS_SKIN_SINGLE
=
0
,
ALIAS_SKIN_GROUP
,
ENSURE_INT_ALIAS_SKIN_TYPE
=
0x70000000
}
aliasskintype_t
;
typedef
struct
{
int
ident
;
...
...
common/net_udp.c
View file @
58fecfb3
...
...
@@ -54,6 +54,10 @@ struct in_addr {
#define SO_BROADCAST SCE_NET_SO_BROADCAST
#endif
#ifdef _3DS
#define SO_BROADCAST 0x20
#endif
#ifndef INADDR_NONE
#define INADDR_NONE ((uint32_t) 0xffffffff)
/* 255.255.255.255 */
#endif
...
...
common/pr_comp.h
View file @
58fecfb3
...
...
@@ -44,7 +44,7 @@ typedef int etype_t;
#else
typedef
enum
{
ev_void
,
ev_string
,
ev_float
,
ev_vector
,
ev_entity
,
ev_field
,
ev_function
,
ev_pointer
ev_function
,
ev_pointer
,
ENSURE_INT_ETYPE
=
0x70000000
}
etype_t
;
#endif
...
...
common/qtypes.h
View file @
58fecfb3
...
...
@@ -34,7 +34,7 @@ typedef unsigned char byte;
typedef
enum
{
false
,
true
};
typedef
int
qboolean
;
#else
typedef
enum
{
false
,
true
}
qboolean
;
typedef
enum
{
false
,
true
,
ENSURE_INT_QBOOL
=
0x70000000
}
qboolean
;
#endif
#ifndef offsetof
...
...
common/r_bsp.c
View file @
58fecfb3
...
...
@@ -38,7 +38,7 @@ static float entity_rotation[3][3];
int
r_currentbkey
;
typedef
enum
{
touchessolid
,
drawnode
,
nodrawnode
}
solidstate_t
;
typedef
enum
{
touchessolid
,
drawnode
,
nodrawnode
,
ENSURE_INT_SOLID_STATE
=
0x70000000
}
solidstate_t
;
#define MAX_BMODEL_VERTS 500 // 6K
#define MAX_BMODEL_EDGES 1000 // 12K
...
...
common/server.h
View file @
58fecfb3
...
...
@@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "progs.h"
#include "client.h"
typedef
enum
{
ss_loading
,
ss_active
}
server_state_t
;
typedef
enum
{
ss_loading
,
ss_active
,
ENSURE_INT_SERVER_STATE
=
0x70000000
}
server_state_t
;
typedef
struct
{
qboolean
active
;
// false if only a net client
...
...
common/snd_codec.h
View file @
58fecfb3
...
...
@@ -43,7 +43,8 @@ typedef enum {
STREAM_NONE
=
-
1
,
STREAM_INIT
,
STREAM_PAUSE
,
STREAM_PLAY
STREAM_PLAY
,
ENSURE_INT_STREAM_STATUS
=
0x70000000
}
stream_status_t
;
typedef
struct
snd_codec_s
snd_codec_t
;
...
...
common/spritegn.h
View file @
58fecfb3
...
...
@@ -67,7 +67,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// must match definition in modelgen.h
#ifndef SYNCTYPE_T
#define SYNCTYPE_T
typedef
enum
{
ST_SYNC
=
0
,
ST_RAND
}
synctype_t
;
typedef
enum
{
ST_SYNC
=
0
,
ST_RAND
,
ENSURE_INT_SYNCTYPE
=
0x70000000
}
synctype_t
;
#endif
// TODO: shorten these?
...
...
@@ -103,7 +103,7 @@ typedef struct {
float
interval
;
}
dspriteinterval_t
;
typedef
enum
{
SPR_SINGLE
=
0
,
SPR_GROUP
}
spriteframetype_t
;
typedef
enum
{
SPR_SINGLE
=
0
,
SPR_GROUP
,
ENSURE_INT_SPRITEFRAMTYPE
=
0x70000000
}
spriteframetype_t
;
typedef
struct
{
spriteframetype_t
type
;
...
...
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