Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 69 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@ jobs:
env:
cache-name: cache-build-dependencies
with:
path: mingw64/x86_64-w64-mingw32
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('mingw64/build_deps.sh') }}
path: extras/x86_64-w64-mingw32
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('extras/build-mingw64.sh') }}
- name: Build dependencies
run: (test -d mingw64/x86_64-w64-mingw32 && echo Build dependencies found, skip rebuild) || ./mingw64/build_deps.sh
run: (test -d extras/x86_64-w64-mingw32 && echo Build dependencies found, skip rebuild) || ./extras/build-mingw64.sh
- name: Run cmake
run: |
export PKG_CONFIG_LIBDIR=$(pwd)/mingw64/x86_64-w64-mingw32/lib/pkgconfig
export PKG_CONFIG_LIBDIR=$(pwd)/extras/x86_64-w64-mingw32/lib/pkgconfig
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../mingw64/toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
cmake -DCMAKE_TOOLCHAIN_FILE=../extras/mingw64-toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
- name: Build
run: |
cd build
Expand All @@ -84,3 +84,67 @@ jobs:
path: |
build/msfce.exe
build/*.dll
build-macos-x86-64:
needs: clang-format
runs-on: macos-11
steps:
- uses: actions/checkout@v1
- uses: n1hility/cancel-previous-runs@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch submodules
run: git submodule update --init --recursive
- name: Install required system packages
run: |
brew install coreutils wget cmake pkg-config nasm meson ninja
- name: Cache build dependencies
uses: actions/cache@v2
env:
cache-name: cache-build-dependencies
with:
path: extras/apple-darwin-x86_64
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('extras/build-macos.sh') }}
- name: Build dependencies
run: (test -d extras/apple-darwin-x86_64 && echo Build dependencies found, skip rebuild) || ./extras/build-macos.sh
- name: Run cmake
run: |
export PKG_CONFIG_LIBDIR=$(pwd)/extras/apple-darwin-x86_64/lib/pkgconfig
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
- name: Build
run: |
cd build
make -j2
build-macos-arm64:
needs: clang-format
runs-on: macos-11
steps:
- uses: actions/checkout@v1
- uses: n1hility/cancel-previous-runs@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Fetch submodules
run: git submodule update --init --recursive
- name: Install required system packages
run: |
brew install coreutils wget cmake pkg-config nasm meson ninja
- name: Cache build dependencies
uses: actions/cache@v2
env:
cache-name: cache-build-dependencies
with:
path: extras/apple-darwin-arm64
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('extras/build-macos.sh') }}
- name: Build dependencies
run: (test -d extras/apple-darwin-arm64 && echo Build dependencies found, skip rebuild) || ./extras/build-macos.sh -a arm64
- name: Run cmake
run: |
export PKG_CONFIG_LIBDIR=$(pwd)/extras/apple-darwin-arm64/lib/pkgconfig
mkdir build
cd build
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_BUILD_TYPE=Release ..
- name: Build
run: |
cd build
make -j2
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
build
build*
extras/apple-darwin-arm64
extras/apple-darwin-x86_64
extras/x86_64-w64-mingw32
42 changes: 34 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,44 @@ sudo apt install mingw-w64 cmake pkg-config wget unzip \
meson ninja-build nasm
```

Build dependencies
```
export PKG_CONFIG_LIBDIR=$(pwd)/mingw64/x86_64-w64-mingw32/lib/pkgconfig
./mingw64/build_deps.sh
```

Build
```
export PKG_CONFIG_LIBDIR=$(pwd)/mingw64/x86_64-w64-mingw32/lib/pkgconfig
./extras/build-mingw64.sh
export PKG_CONFIG_LIBDIR=$(pwd)/extras/x86_64-w64-mingw32/lib/pkgconfig
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../mingw64/toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
cmake -DCMAKE_TOOLCHAIN_FILE=../extras/mingw64-toolchain.cmake -DCMAKE_BUILD_TYPE=Release ..
make
```

### macOS

Both Mac Intel and Mac M1 targets are supported, but build has only been tested on Mac Intel.

Install required packages
```
brew install coreutils wget cmake pkg-config nasm meson ninja
```

#### Build for Mac Intel

Build for Intel
```
./extras/build-macos.sh
export PKG_CONFIG_LIBDIR=$(pwd)/extras/apple-darwin-x86_64/lib/pkgconfig
mkdir build-x86_64
cd build-x86_64
cmake -DCMAKE_BUILD_TYPE=Release ..
make
```

#### Build for M1
```
./extras/build-macos.sh -a arm64
export PKG_CONFIG_LIBDIR=$(pwd)/extras/apple-darwin-arm64/lib/pkgconfig
mkdir build-arm64
cd build-arm64
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_BUILD_TYPE=Release ..
make
```

Expand Down
1 change: 0 additions & 1 deletion app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ target_link_libraries(msfce
${PKG_SWSCALE_LIBRARIES}
${PKG_SWRESAMPLE_LIBRARIES}

-lstdc++fs
-lpthread
)

Expand Down
2 changes: 1 addition & 1 deletion app/frontend_sdl2/controller_sdl2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace {

struct SnesControllerMapping {
const char* name;
off64_t offset;
off_t offset;
};

// clang-format off
Expand Down
5 changes: 5 additions & 0 deletions app/frontend_sdl2/frontend_sdl2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ int FrontendSdl2::init(const std::shared_ptr<msfce::core::Snes>& snes)
assert(m_Window);

// Init OpenGl context
SDL_GL_SetAttribute(
SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3);

m_GlContext = SDL_GL_CreateContext(m_Window);
assert(m_GlContext);

Expand Down
2 changes: 1 addition & 1 deletion app/recorder/recorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace msfce::recorder {

struct Frame;
struct FrameRecorder;
class FrameRecorder;

class Recorder : public msfce::core::Renderer {
public:
Expand Down
1 change: 0 additions & 1 deletion app/recorder/videorecorder.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ class VideoRecorder : public FrameRecorderBackend {
AVStream* m_AudioStream = nullptr;
AVAudioFifo* m_AudioFifo = nullptr;
SwrContext* m_AudioSwrCtx = nullptr;
int m_AudioFrameIdx = 0;
int m_AudioInSamples = 0;
int m_AudioOutSamples = 0;
int m_AudioSnesFrameSize = 0;
Expand Down
8 changes: 4 additions & 4 deletions app/renderer_gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ namespace {

// clang-format off
const char *vertexShader =
"#version 130\n"
"in vec3 aPos;"
"in vec2 aTexCoord;"
"#version 330 core\n"
"layout (location = 0) in vec3 aPos;"
"layout (location = 1) in vec2 aTexCoord;"

"uniform mat4 scaleMatrix;"
"out vec2 TexCoord;"
Expand All @@ -29,7 +29,7 @@ const char *vertexShader =
"}";

const char *fragmentShader =
"#version 130\n"
"#version 330 core\n"
"out vec4 FragColor;"

"in vec3 ourColor;"
Expand Down
5 changes: 5 additions & 0 deletions core/include/msfce/core/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ enum LogLevel : uint32_t {
typedef void (
*log_cb_t)(uint32_t prio, const char* tag, const char* fmt, va_list ap);

#if defined(__GNUC__) && !defined(__clang__)
void __log(uint32_t prio, const char* tag, const char* fmt, ...)
__attribute__((format(gnu_printf, 3, 4)));
#else
void __log(uint32_t prio, const char* tag, const char* fmt, ...)
__attribute__((format(printf, 3, 4)));
#endif

void logSetLevel(uint32_t prio);
2 changes: 1 addition & 1 deletion core/src/controllerports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace {

struct RegisterMapping {
off64_t offset;
off_t offset;
int bit;
};

Expand Down
3 changes: 1 addition & 2 deletions core/src/membus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ constexpr uint32_t kComponentAccessRW = kComponentAccessR | kComponentAccessW;

namespace msfce::core {

Membus::Membus(AddressingType addrType, bool fastRom)
: m_AddrType(addrType), m_FastRom(fastRom)
Membus::Membus(AddressingType addrType, bool fastRom) : m_FastRom(fastRom)
{
if (addrType == AddressingType::lowrom) {
initLowRom();
Expand Down
1 change: 0 additions & 1 deletion core/src/membus.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ class Membus {
void internalWriteU8(uint32_t addr, uint8_t value);

private:
AddressingType m_AddrType;
bool m_FastRom = false;

Bank m_Banks[0x100];
Expand Down
2 changes: 1 addition & 1 deletion core/src/ppu.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class Ppu
int tileHeightPixel;

int tileBpp;
int tileSize = tileBpp * 8;
int tileSize;

TilemapMapper tilemapMapper;

Expand Down
2 changes: 1 addition & 1 deletion core/src/snesimpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ int SnesImpl::plugCartidge(const char* path)
return ret;
}

LOGI(TAG, "Rom size: %lu bytes", fStat.st_size);
LOGI(TAG, "Rom size: %jd bytes", static_cast<intmax_t>(fStat.st_size));

// Read file content
std::vector<uint8_t> rom(fStat.st_size);
Expand Down
5 changes: 1 addition & 4 deletions core/src/snesimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,12 @@ class SnesImpl
int renderSingleFrame(bool renderPpu = true) final;

void setController1(const Controller& controller) final;
;

void saveState(const std::string& path) final;
;
void loadState(const std::string& path) final;
;

// Scheduler methods
void resumeTask(SchedulerTask* task, int cycles);
void resumeTask(SchedulerTask* task, int cycles) final;

// MemComponent methods
uint8_t readU8(uint32_t addr) override;
Expand Down
File renamed without changes.
Loading