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
retro8
Commits
9e5d641a
Unverified
Commit
9e5d641a
authored
Feb 28, 2022
by
Libretro-Admin
Committed by
GitHub
Feb 28, 2022
Browse files
Merge pull request #6 from phcoder/em
Add emscripten, libnx, vita and 3DS compilation
parents
97d72688
39318811
Pipeline
#90371
passed with stages
in 7 minutes and 9 seconds
Changes
10
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
9e5d641a
...
...
@@ -53,9 +53,13 @@ include:
################################## CONSOLES ################################
# PlayStation Vita
#- project: 'libretro-infrastructure/ci-templates'
#file: '/vita-static.yml'
-
project
:
'
libretro-infrastructure/ci-templates'
file
:
'
/vita-static.yml'
# Nintendo 3DS
-
project
:
'
libretro-infrastructure/ci-templates'
file
:
'
/ctr-static.yml'
# Nintendo GameCube
#- project: 'libretro-infrastructure/ci-templates'
#file: '/ngc-static.yml'
...
...
@@ -64,6 +68,10 @@ include:
#- project: 'libretro-infrastructure/ci-templates'
#file: '/wii-static.yml'
# Nintendo Switch
-
project
:
'
libretro-infrastructure/ci-templates'
file
:
'
/libnx-static.yml'
# tvOS (AppleTV)
-
project
:
'
libretro-infrastructure/ci-templates'
file
:
'
/tvos-arm64.yml'
...
...
@@ -77,6 +85,9 @@ include:
file
:
'
/dingux-arm32.yml'
#################################### MISC ##################################
# Emscripten
-
project
:
'
libretro-infrastructure/ci-templates'
file
:
'
/emscripten-static.yml'
# Stages for building
stages
:
...
...
@@ -169,6 +180,12 @@ libretro-build-tvos-arm64:
-
.core-defs
################################### CONSOLES #################################
# Nintendo 3DS
libretro-build-ctr
:
extends
:
-
.libretro-ctr-static-retroarch-master
-
.core-defs
# Nintendo GameCube
#libretro-build-ngc:
#extends:
...
...
@@ -180,12 +197,18 @@ libretro-build-tvos-arm64:
#extends:
#- .libretro-wii-static-retroarch-master
#- .core-defs
# Nintendo Switch
libretro-build-libnx-aarch64
:
extends
:
-
.libretro-libnx-static-retroarch-master
-
.core-defs
# PlayStation Vita
#
libretro-build-vita:
#
extends:
#
- .libretro-vita-static-retroarch-master
#
- .core-defs
libretro-build-vita
:
extends
:
-
.libretro-vita-static-retroarch-master
-
.core-defs
# RetroFW
libretro-build-retrofw-mips32
:
...
...
@@ -198,3 +221,10 @@ libretro-build-miyoo-arm32:
extends
:
-
.libretro-miyoo-arm32-make-default
-
.core-defs
#################################### MISC ##################################
# Emscripten
libretro-build-emscripten
:
extends
:
-
.libretro-emscripten-static-retroarch-master
-
.core-defs
Makefile
View file @
9e5d641a
...
...
@@ -49,6 +49,11 @@ ifeq ($(STATIC_LINKING), 1)
EXT
:=
a
endif
GIT_VERSION
:=
"
$(
shell
git rev-parse --short HEAD || echo unknown
)
"
ifneq
($(GIT_VERSION)," unknown")
CXXFLAGS
+=
-DGIT_VERSION
=
\"
$(GIT_VERSION)
\"
endif
ifneq
(,$(findstring unix,$(platform)))
EXT
?=
so
TARGET
:=
$(TARGET_NAME)
_libretro.
$(EXT)
...
...
@@ -187,11 +192,30 @@ else ifeq ($(platform), miyoo)
CFLAGS
+=
-fmerge-all-constants
-fno-math-errno
-fno-stack-protector
-fno-ident
CXXFLAGS
:=
$(ASFLAGS)
$(CFLAGS)
else
ifeq
($(platform), vita)
TARGET
:=
$(TARGET_NAME)
_vita.a
TARGET
:=
$(TARGET_NAME)
_
libretro_
vita.a
CC
=
arm-vita-eabi-gcc
CXX
=
arm-vita-eabi-g++
AR
=
arm-vita-eabi-ar
CXXFLAGS
+=
-Wl
,-q
-Wall
-O3
STATIC_LINKING
=
1
# CTR/3DS
else
ifeq
($(platform), ctr)
TARGET
:=
$(TARGET_NAME)
_libretro_
$(platform)
.a
CC
=
$(DEVKITARM)
/bin/arm-none-eabi-gcc
$(EXE_EXT)
CXX
=
$(DEVKITARM)
/bin/arm-none-eabi-g++
$(EXE_EXT)
AR
=
$(DEVKITARM)
/bin/arm-none-eabi-ar
$(EXE_EXT)
CFLAGS
+=
-DARM11
-D_3DS
CFLAGS
+=
-march
=
armv6k
-mtune
=
mpcore
-mfloat-abi
=
hard
CFLAGS
+=
-Wall
-mword-relocations
CFLAGS
+=
-fomit-frame-pointer
-ffast-math
CXXFLAGS
+=
-DARM11
-D_3DS
CXXFLAGS
+=
-march
=
armv6k
-mtune
=
mpcore
-mfloat-abi
=
hard
CXXFLAGS
+=
-Wall
-mword-relocations
CXXFLAGS
+=
-fomit-frame-pointer
-ffast-math
HAVE_RZLIB
:=
1
DISABLE_ERROR_LOGGING
:=
1
ARM
=
1
STATIC_LINKING
=
1
else
CC
?=
gcc
TARGET
:=
$(TARGET_NAME)
_libretro.dll
...
...
src/io/loader.cpp
View file @
9e5d641a
...
...
@@ -74,14 +74,14 @@ std::vector<std::string> Loader::loadLines(T& input)
void
Loader
::
loadFile
(
const
std
::
string
&
path
,
Machine
&
dest
)
{
auto
stream
=
std
::
ifstream
(
path
);
std
::
if
stream
stream
(
path
);
assert
(
stream
.
good
());
load
(
loadLines
(
stream
),
dest
);
}
void
Loader
::
loadRaw
(
const
std
::
string
&
data
,
Machine
&
dest
)
{
auto
stream
=
std
::
stringstream
(
data
);
std
::
stringstream
stream
(
data
);
load
(
loadLines
(
stream
),
dest
);
}
...
...
src/libretro/libretro.cpp
View file @
9e5d641a
...
...
@@ -90,10 +90,13 @@ extern "C"
void
retro_get_system_info
(
retro_system_info
*
info
)
{
std
::
memset
(
info
,
0
,
sizeof
(
info
));
std
::
memset
(
info
,
0
,
sizeof
(
*
info
));
info
->
library_name
=
"retro-8 (alpha)"
;
info
->
library_version
=
"0.1b"
;
#ifndef GIT_VERSION
#define GIT_VERSION ""
#endif
info
->
library_version
=
"0.1b"
GIT_VERSION
;
info
->
need_fullpath
=
false
;
info
->
valid_extensions
=
"p8|png"
;
}
...
...
src/libretro/slock_wrapper.cpp
0 → 100644
View file @
9e5d641a
#include "slock_wrapper.h"
#ifndef USE_SLOCK_WRAPPER
#elif defined(PS2) || defined(WIIU) // Single-threaded
slock_wrap
::
slock_wrap
()
{
}
slock_wrap
::~
slock_wrap
()
{
}
void
slock_wrap
::
lock
()
{
}
void
slock_wrap
::
unlock
()
{
}
bool
slock_wrap
::
try_lock
()
{
return
true
;
}
#else
extern
"C"
{
slock_t
*
slock_new
(
void
);
void
slock_free
(
slock_t
*
lock
);
void
slock_lock
(
slock_t
*
lock
);
void
slock_unlock
(
slock_t
*
lock
);
void
slock_free
(
slock_t
*
lock
);
bool
slock_try_lock
(
slock_t
*
lock
);
}
slock_wrap
::
slock_wrap
()
{
slck
=
slock_new
();
}
slock_wrap
::~
slock_wrap
()
{
slock_free
(
slck
);
}
void
slock_wrap
::
lock
()
{
slock_lock
(
slck
);
}
void
slock_wrap
::
unlock
()
{
slock_unlock
(
slck
);
}
bool
slock_wrap
::
try_lock
()
{
return
slock_try_lock
(
slck
);
}
#endif
src/libretro/slock_wrapper.h
0 → 100644
View file @
9e5d641a
#pragma once
#if defined(_3DS) || defined(__PSP__) || defined(PS2) || defined(WIIU)
#define USE_SLOCK_WRAPPER 1
#endif
#ifdef USE_SLOCK_WRAPPER
typedef
struct
slock
slock_t
;
class
slock_wrap
{
public:
slock_wrap
();
~
slock_wrap
();
void
lock
();
void
unlock
();
bool
try_lock
();
private:
slock_t
*
slck
;
};
#endif
src/lua/loslib.c
View file @
9e5d641a
...
...
@@ -150,6 +150,7 @@ static int os_execute (lua_State *L) {
return 1;
}
*/
return
1
;
}
...
...
src/vm/lua_bridge.cpp
View file @
9e5d641a
...
...
@@ -247,7 +247,7 @@ namespace draw
uint8_t
w
=
lua_tonumber
(
L
,
3
);
uint8_t
h
=
lua_tonumber
(
L
,
4
);
machine
.
memory
().
clipRect
()
->
set
(
x0
,
y0
,
std
::
min
(
x0
+
w
,
int32_t
(
gfx
::
SCREEN_WIDTH
-
1
)
)
,
std
::
min
(
y0
+
h
,
int32_t
(
gfx
::
SCREEN_HEIGHT
-
1
))
)
;
machine
.
memory
().
clipRect
()
->
set
(
x0
,
y0
,
std
::
min
<
int32_t
>
(
x0
+
w
,
gfx
::
SCREEN_WIDTH
-
1
),
std
::
min
<
int32_t
>
(
y0
+
h
,
gfx
::
SCREEN_HEIGHT
-
1
));
}
return
0
;
...
...
src/vm/sound.cpp
View file @
9e5d641a
...
...
@@ -413,7 +413,7 @@ void APU::renderSounds(int16_t* dest, size_t totalSamples)
{
/* generate the maximum amount of samples available for same note */
// TODO: optimize if next note is equal to current
size_t
available
=
std
::
min
(
samples
,
samplePerTick
-
(
channel
.
position
%
samplePerTick
));
size_t
available
=
std
::
min
<
ssize_t
>
(
samples
,
samplePerTick
-
(
channel
.
position
%
samplePerTick
));
renderSound
(
channel
,
buffer
,
available
);
samples
-=
available
;
...
...
src/vm/sound.h
View file @
9e5d641a
...
...
@@ -5,7 +5,12 @@
#include <array>
#include <vector>
#ifdef __LIBRETRO__
#include "slock_wrapper.h"
#endif
#ifndef USE_SLOCK_WRAPPER
#include <mutex>
#endif
#if SOUND_ENABLED
...
...
@@ -200,7 +205,11 @@ namespace retro8
std
::
array
<
SoundState
,
CHANNEL_COUNT
>
channels
;
MusicState
mstate
;
#ifdef USE_SLOCK_WRAPPER
slock_wrap
queueMutex
;
#else
std
::
mutex
queueMutex
;
#endif
std
::
vector
<
Command
>
queue
;
bool
_soundEnabled
,
_musicEnabled
;
...
...
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