Skip to content

Commit

Permalink
beta10.1 (libretro only)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerKoun committed Jan 17, 2020
1 parent 6bf68d6 commit 4413ef4
Show file tree
Hide file tree
Showing 23 changed files with 1,179 additions and 870 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# bsnes-hd *beta 10*
# bsnes-hd *beta 10.1*

- [downloads](https://github.com/DerKoun/bsnes-hd/releases) for the latest betas
- [GitHub project](https://github.com/DerKoun/bsnes-hd) for source code, issues, feature requests, ...
Expand Down Expand Up @@ -118,7 +118,7 @@ Specifies how translucent the widescreen markers are. (defaults to 1/1)
Settings for the background layers.
- **off**: no widescreen (e.g. for HUDs)
- **on**: widescreen enabled
- **< xy**/**> xy**: widescreen enabled above/below a certain scanline (for backgrounds that contain HUDs and backgrounds).
- **< xy**/**> xy**: widescreen enabled above/below a certain scanline (for backgrounds that contain HUDs and backgrounds), e.g. for "*HyperZone*" at "*BG2: >80*".
- **autoHor**: Disables widescreen for this background when it is as wide as the screen and has a horizontal position of 0.
- **autoHor&Ver**(default): Disables widescreen for this background when it is as wide as the screen and has a horizontal and vertical position of 0.
- **crop**: do not draw the left- and right-most 8 pixels (next to the widescreen areas) of the background (for backgrounds blanking some edge pixels, leaving black lines in widescreen, e.g. "*Top Gear 2*").
Expand Down
3 changes: 0 additions & 3 deletions bsnes/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,6 @@ ui := target-$(target)
include $(ui)/GNUmakefile
-include obj/*.d


delete = $(info Deleting $1 ...) @rm -f $1

clean:
$(call delete,obj/*)
$(call delete,out/*)
2 changes: 0 additions & 2 deletions bsnes/emulator/audio/audio.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#define double float

namespace Emulator {

#include "stream.cpp"
Expand Down
1 change: 0 additions & 1 deletion bsnes/emulator/audio/audio.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#pragma once
#define double float

#include <nall/dsp/iir/dc-removal.hpp>
#include <nall/dsp/iir/one-pole.hpp>
Expand Down
4 changes: 3 additions & 1 deletion bsnes/emulator/emulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
#include <nall/adaptive-array.hpp>
#include <nall/any.hpp>
#include <nall/chrono.hpp>
#ifndef PLATFORM_HORIZON
#include <nall/dl.hpp>
#endif // PLATFORM_HORIZON
#include <nall/endian.hpp>
#include <nall/image.hpp>
#include <nall/literals.hpp>
Expand All @@ -29,7 +31,7 @@ using namespace nall;

namespace Emulator {
static const string Name = "bsnes-hd beta";
static const string Version = "10";//bsnes/target-bsnes/presentation/presentation.cpp:create:about:setVersion
static const string Version = "10.1";//bsnes/target-bsnes/presentation/presentation.cpp:create:about:setVersion
static const string Author = "DerKoun(byuu)";
static const string License = "GPLv3";
static const string Website = "https://github.com/DerKoun/bsnes-hd";
Expand Down
2 changes: 1 addition & 1 deletion bsnes/emulator/platform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct Platform {
virtual auto open(uint id, string name, vfs::file::mode mode, bool required = false) -> shared_pointer<vfs::file> { return {}; }
virtual auto load(uint id, string name, string type, vector<string> options = {}) -> Load { return {}; }
virtual auto videoFrame(const uint32* data, uint pitch, uint width, uint height, uint scale) -> void {}
virtual auto audioFrame(const float* samples, uint channels) -> void {}
virtual auto audioFrame(const double* samples, uint channels) -> void {}
virtual auto inputPoll(uint port, uint device, uint input) -> int16 { return 0; }
virtual auto inputRumble(uint port, uint device, uint input, bool enable) -> void {}
virtual auto dipSettings(Markup::Node node) -> uint { return 0; }
Expand Down
1 change: 0 additions & 1 deletion bsnes/gb/GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
flags += -DGB_INTERNAL -DDISABLE_DEBUGGER -D_GNU_SOURCE -Wno-multichar
options += -I../sameboy

objects += gb-apu gb-camera gb-display gb-gb gb-joypad gb-mbc
objects += gb-memory gb-printer gb-random gb-rewind gb-save_state gb-sgb
Expand Down
2 changes: 1 addition & 1 deletion bsnes/sfc/coprocessor/icd/interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ auto ICD::ppuWrite(uint2 color) -> void {
}

auto ICD::apuWrite(float left, float right) -> void {
float samples[] = {left, right};
double samples[] = {left, right};
if(!system.runAhead) stream->write(samples);
}

Expand Down
9 changes: 4 additions & 5 deletions bsnes/target-bsnes/program/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,13 @@ auto Program::videoFrame(const uint32* data, uint pitch, uint width, uint height
}
}

auto Program::audioFrame(const float* samples, uint channels) -> void {
auto Program::audioFrame(const double* samples, uint channels) -> void {
if(mute) {
double silence[] = {0.0, 0.0};
return audio.output(silence);
audio.output(silence);
} else {
audio.output(samples);
}

double frame[] = {samples[0], samples[1]};
audio.output(frame);
}

auto Program::inputPoll(uint port, uint device, uint input) -> int16 {
Expand Down
2 changes: 1 addition & 1 deletion bsnes/target-bsnes/program/program.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct Program : Lock, Emulator::Platform {
auto open(uint id, string name, vfs::file::mode mode, bool required) -> shared_pointer<vfs::file> override;
auto load(uint id, string name, string type, vector<string> options = {}) -> Emulator::Platform::Load override;
auto videoFrame(const uint32* data, uint pitch, uint width, uint height, uint scale) -> void override;
auto audioFrame(const float* samples, uint channels) -> void override;
auto audioFrame(const double* samples, uint channels) -> void override;
auto inputPoll(uint port, uint device, uint input) -> int16 override;
auto inputRumble(uint port, uint device, uint input, bool enable) -> void override;

Expand Down
7 changes: 7 additions & 0 deletions bsnes/target-libretro/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ ifeq ($(platform), ios-arm64)
else ifeq ($(platform), tvos-arm64)
flags += -fPIC -mtvos-version-min=11.0 -Wno-error=implicit-function-declaration -DHAVE_POSIX_MEMALIGN
options += -dynamiclib
else ifeq ($(platform), libnx)
flags += -march=armv8-a+crc -mtune=cortex-a57 -mtp=soft -mcpu=cortex-a57+crc+fp+simd -DHAVE_POSIX_MEMALIGN
flags += -O2 -ftree-vectorize -ffast-math -funsafe-math-optimizations -fPIE -I$(PORTLIBS)/include/ -I$(LIBNX)/include/ -ffunction-sections -fdata-sections -ftls-model=local-exec
flags += -D__SWITCH__=1 -D__aarch64__=1 -DSWITCH -DHAVE_LIBNX
name = $(name)_libnx
endif

objects := libretro $(objects)
Expand All @@ -21,6 +26,8 @@ ifeq ($(platform),linux)
$(strip $(compiler) -o out/$(name).so -shared $(objects) -Wl,--no-undefined -Wl,--version-script=target-libretro/link.T -lgomp -Wl,-Bdynamic $(options))
else ifeq ($(platform),windows)
$(strip $(compiler) -o out/$(name).dll -shared $(objects) -Wl,--no-undefined -Wl,--version-script=target-libretro/link.T -lgomp -Wl,-Bdynamic $(options))
else ifeq ($(platform),libnx)
$(strip $(AR) rcs out/$(name).a $(objects))
else ifeq ($(platform),macos)
$(strip $(compiler) -o out/$(name).dylib -shared $(objects) $(options))
else ifeq ($(platform), ios-arm64)
Expand Down
20 changes: 20 additions & 0 deletions bsnes/target-libretro/libretro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ static void audio_queue(int16_t left, int16_t right)
#include "program.cpp"

static string sgb_bios;
static vector<string> cheatList;

#define RETRO_DEVICE_JOYPAD_MULTITAP RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_JOYPAD, 0)
#define RETRO_DEVICE_LIGHTGUN_SUPER_SCOPE RETRO_DEVICE_SUBCLASS(RETRO_DEVICE_LIGHTGUN, 0)
Expand Down Expand Up @@ -853,10 +854,29 @@ RETRO_API bool retro_unserialize(const void *data, size_t size)

RETRO_API void retro_cheat_reset()
{
cheatList.reset();
emulator->cheats(cheatList);
}

RETRO_API void retro_cheat_set(unsigned index, bool enabled, const char *code)
{
string cheat = string(code);
bool decoded = false;

if (program->gameBoy.program)
{
decoded = decodeGB(cheat);
}
else
{
decoded = decodeSNES(cheat);
}

if (enabled && decoded)
{
cheatList.append(cheat);
emulator->cheats(cheatList);
}
}

RETRO_API bool retro_load_game(const retro_game_info *game)
Expand Down
Loading

0 comments on commit 4413ef4

Please sign in to comment.