beta 10.3

This commit is contained in:
DerKoun 2020-02-19 00:10:57 +01:00
parent 3a74cbe0dc
commit 87173e8ec8
14 changed files with 253 additions and 60 deletions

93
.github/workflows/CI.yml vendored Normal file
View file

@ -0,0 +1,93 @@
name: CI
on:
push:
pull_request:
jobs:
Windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build
run: mingw32-make -j $env:NUMBER_OF_PROCESSORS -C bsnes
- name: Prepare artifacts
run: |
mkdir bsnes/out/pack
unzip packraw.zip -d bsnes/out/pack
cp README.md bsnes/out/pack
cp bsnes/out/bsnes.exe bsnes/out/pack
mv bsnes/out/pack/bsnes.exe bsnes/out/pack/bsnes_hd.exe
- name: Upload artifacts
uses: actions/upload-artifact@v1.0.0
with:
name: bsnes_hd_build-${{ runner.os }}
path: bsnes\out\pack
Linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup
run: |
sudo apt-get update
sudo apt-get -y install build-essential libgtk2.0-dev libpulse-dev mesa-common-dev libgtksourceview2.0-dev libcairo2-dev libsdl2-dev libxv-dev libao-dev libopenal-dev libudev-dev zip
- name: Build
run: make -j $(nproc) -C bsnes
- name: Prepare artifacts
run: |
mkdir bsnes/out/pack
unzip packraw.zip -d bsnes/out/pack
cp README.md bsnes/out/pack
cp -R bsnes/out/*bsnes* bsnes/out/pack
mv bsnes/out/pack/bsnes bsnes/out/pack/bsnes_hd
- name: Upload artifacts
uses: actions/upload-artifact@v1.0.0
with:
name: bsnes_hd_build-${{ runner.os }}
path: bsnes/out/pack
macOS:
runs-on: macos
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build
run: make -j $(sysctl -n hw.ncpu) -C bsnes
- name: Prepare artifacts
run: |
mkdir bsnes/out/pack
unzip packraw.zip -d bsnes/out/pack
cp README.md bsnes/out/pack
cp -R bsnes/out/*bsnes* bsnes/out/pack
mv bsnes/out/pack/bsnes.app bsnes/out/pack/bsnes_hd.app
- name: Upload artifacts
uses: actions/upload-artifact@v1.0.0
with:
name: bsnes_hd_build-${{ runner.os }}
path: bsnes/out/pack
macOS-libretro:
runs-on: macos
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build
run: make -j $(sysctl -n hw.ncpu) -C bsnes target=libretro
- name: Prepare artifacts
run: |
mkdir bsnes/out/pack
cp README.md bsnes/out/pack
cp LICENSE bsnes/out/pack
cp -R bsnes/out/*bsnes* bsnes/out/pack
- name: Upload artifacts
uses: actions/upload-artifact@v1.0.0
with:
name: bsnes_hd_libretro_build-${{ runner.os }}
path: bsnes/out/pack

View file

@ -1,4 +1,4 @@
# bsnes-hd *beta 10.2*
# bsnes-hd *beta 10.3*
- [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, ...
@ -166,19 +166,69 @@ The amount of neighboring lines used to smooth Window effects, like iris transit
In *bsnes* the overscan setting allows switching between cropping 8 and 0 lines form top and bottom, which are unused due to the way TVs in the time of the SNES worked. In *bsnes-hd* it switches between 12 and 8 lines, defaulting to 12 (*off*). This cuts of 4 lines on both sides that technically contain content, but should not cut important information as these lines are still in an area that wasn't safe to use (12 lines is 5%). The reason to do is that the resulting height of 216 is exactly a 5th of 1080, so you can integer scale to HD and 4K resolutions, e.g. *5x* at *16:9* is exactly *1080 HD* with every Mode 7 pixel rendered specifically.
### Settings / Output / (Pixel) Aspect Correction
Renamed Aspect Correction to Pixel Aspect Correction to avoid confusion with the widescreen aspect ratio.
## Widescreen Technical
### Dimensions
The amount of pixel columns added to both sides for the various aspect ratios are, depending on some settings:
- overscan *off*, aspect correction *off*: (4:3, 16), (16:10, 44), (16:9, 64), (2:1, 88), (21:9, 124).
- overscan *on*, aspect correction *off*: (4:3, 20), (16:10, 52), (16:9, 72), (2:1, 96), (21:9, 132).
- overscan *on*, aspect correction *on*: (4:3, 0), (16:10, 24), (16:9, 44), (2:1, 64), (21:9, 96).
- overscan *off*, pixel aspect correction *off*: (4:3, 16), (16:10, 44), (16:9, 64), (2:1, 88), (21:9, 124).
- overscan *on*, pixel aspect correction *off*: (4:3, 20), (16:10, 52), (16:9, 72), (2:1, 96), (21:9, 132).
- overscan *on*, pixel aspect correction *on*: (4:3, 0), (16:10, 24), (16:9, 44), (2:1, 64), (21:9, 96).
### Maximum width for objects/sprites
The maximum width for widescreen areas that still can have places objects in them is *96* (exactly 2:1 AR with overscan *on* and aspect correction *off* or 21:9 with overscan *on* and aspect correction *on*).
The maximum width for widescreen areas that still can have places objects in them is *96* (exactly 2:1 AR with overscan *on* and pixel aspect correction *off* or 21:9 with overscan *on* and pixel aspect correction *on*).
### Object/sprite wrap-around
At that maximum width *352* is the only coordinate that places a large object (width 64) entirely off screen. Smaller value make it reach into the screen from the right, larger ones from the left.
### Setting override files
Along with widescreen patches you can override certain settings via a file with the same name as the ROM and the extension ".bso". It is searched in the same way as patches.
The file must contain alternating letters and numbers, each pair overriding a setting.
**Please note** that this does not work in the libretro core and that the overrides are not cleared when you change the ROM, so restarting the emulator is highly recommended.
#### Settings
| Description | Letter | Values |
| ----------------------------------- | ------- | ----------------------------------------------- |
| widescreen mode | w | 0:off 1:on(always) 2:on(mode7) |
| widescreen sprites | s | 0:safe 1:unsafe(widescreen) 2:clip |
| widescreen aspect ratio | W | 0-200:widescreen-extension 201+:AR(*see below*) |
| widescreen background 1/2/3/4 | b/B/c/C | 0:off 1:on 2:auto(horizontal and vertical) |
| pixel aspect ratio correction | p | 0:off 1:on |
| overscan | o | 0:off(216 lines(5th HD)) 1:on(224 lines) |
| ignore window | i | 0:none 1:outside 2:outside&always 3:all |
| ignore window fallback x-coordinate | I | 0-255:x-coordinate |
#### Widescreen values
Values of 200 and less specify the widescreen extension on each side in pixel columns. It is recommended to use values dividable by as large a power of 2 as possible, at least by 4.
Values larger than 200 specify the aspect ratio as (horizontal*100+vertical), e.g. 16:10, 16:9, 2:1 and 21:9 as 1610, 1609, 201 and 2109, respectively. From this AR the widescreen extension is computed in the same way as for ARs specified in the settings dialog, except that arbitrary ARs can be specified here.
#### Sample
To force enable widescreen, including for sprites and setting a widescreen extension of 64 the file can simply be:
```
w1s1W64
```
Any character that is not a letter or digit is ignored. So you can also do:
```
w : 1
s : 1
W : 64
```
Only the last letter before a number is taken into account, basically allowing comments:
```
widescreen always on: w: 1
widescreen sprites on: s: 1
widescreen extension : W:64
```

View file

@ -1,22 +0,0 @@
version: '{build}'
image:
- Visual Studio 2017
- Ubuntu1804
install:
- cmd: set PATH=%PATH%;C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin
- sh: sudo apt-get update && sudo apt-get -y install build-essential libgtk2.0-dev libpulse-dev mesa-common-dev libgtksourceview2.0-dev libcairo2-dev libsdl2-dev libxv-dev libao-dev libopenal-dev libudev-dev zip
build_script:
- cmd: mingw32-make -C bsnes
- sh: make -C bsnes
after_build:
- cmd: cd bsnes/out && 7z a ../../bsnes_hd_build.zip bsnes.exe
- sh: cd bsnes/out && 7z a ../../bsnes_hd_build.zip bsnes
test: off
artifacts:
- path: bsnes_hd_build.zip

View file

@ -31,7 +31,7 @@ using namespace nall;
namespace Emulator {
static const string Name = "bsnes-hd beta";
static const string Version = "10.2";//bsnes/target-bsnes/presentation/presentation.cpp:create:about:setVersion
static const string Version = "10.3";//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";

View file

@ -12,6 +12,9 @@ namespace HdToolkit {
val *= 7;
val /= 8;
}
if (val <= 256) {
return 0;
}
val -= 256;
val /= 2;
val /= 4;

View file

@ -28,7 +28,7 @@ struct Configuration {
bool blurEmulation = true;
bool colorEmulation = true;
uint saturation = 100;
uint gamma = 150;
uint gamma = 100;
uint luminance = 100;
} video;

View file

@ -156,6 +156,9 @@ auto PPU::Line::renderBackground(PPU::IO::Background& self, uint8 source) -> voi
// In hires mode non-hires backgrounds seem to be rendered on every second pixel (see water in Kirby)
if(self.aboveEnable && !windowAbove[ppufast.winXad(x, false)]) plotHD(above, x, source, mosaicPriority, mctc, true, true);
if(self.aboveEnable && !windowAbove[ppufast.winXad(x, false)]) plotHD(below, x, source, mosaicPriority, mctc, true, true);
// So we force low priority for half of every pixel
if(self.aboveEnable && !windowAbove[ppufast.winXad(x, false)]) plotHD(above, x, source, self.priority[0], mctc, true, false);
if(self.aboveEnable && !windowAbove[ppufast.winXad(x, false)]) plotHD(below, x, source, self.priority[0], mctc, true, false);
} else {
if(self.aboveEnable && !windowAbove[ppufast.winXad(x, false)]) plotAbove(x, source, mosaicPriority, mctc);
if(self.belowEnable && !windowBelow[ppufast.winXad(x, true)]) plotBelow(x, source, mosaicPriority, mctc);

View file

@ -21,24 +21,24 @@ auto PPU::Line::flush() -> void {
for(uint r : range(32)) {
for(uint g : range(32)) {
for(uint b : range(32)) {
double dr = r << 3;
double dg = g << 3;
double db = b << 3;
double dr = r * 255.0 / 31.0;
double dg = g * 255.0 / 31.0;
double db = b * 255.0 / 31.0;
if(saturation != 100) {
double satVal = saturation / 100.0;
double grayInv = (dr + dg + db) / 3 * max(0.0, 1.0 - saturation / 100.0);
double grayInv = (dr + dg + db) / 3 * max(0.0, 1.0 - satVal);
dr = dr * satVal + grayInv;
dg = dg * satVal + grayInv;
db = db * satVal + grayInv;
}
if(gamma != 100) {
double reciprocal = 1.0 / 255.0;
double gamVal = gamma / 100.0;
dr = 255.0 * pow(dr * reciprocal, gamVal);
dg = 255.0 * pow(dg * reciprocal, gamVal);
db = 255.0 * pow(db * reciprocal, gamVal);
double reciprocal = 1.0 / 127.0;
dr = dr > 127.0 ? dr : 127.0 * pow(dr * reciprocal, gamVal);
dg = dg > 127.0 ? dg : 127.0 * pow(dg * reciprocal, gamVal);
db = db > 127.0 ? db : 127.0 * pow(db * reciprocal, gamVal);
}
if(luminance != 100) {

View file

@ -40,7 +40,7 @@ auto Presentation::create() -> void {
if(settings.video.output == "Center") centerViewport.setChecked();
if(settings.video.output == "Scale") scaleViewport.setChecked();
if(settings.video.output == "Stretch") stretchViewport.setChecked();
aspectCorrection.setText("Aspect Correction").setChecked(settings.video.aspectCorrection).onToggle([&] {
aspectCorrection.setText("Pixel Aspect Correction").setChecked(settings.video.aspectCorrection).onToggle([&] {
settings.video.aspectCorrection = aspectCorrection.checked();
emulator->configure("Video/AspectCorrection", settings.video.aspectCorrection);
resizeWindow();

View file

@ -164,6 +164,90 @@ auto Program::loadSuperFamicom(string location) -> bool {
offset += size;
}
// load and apply simple settings override file (if found)
vector<uint8_t> rso;
if(location.endsWith("/")) {
rso = file::read({location, "gamesettings.bso"});
} else if(location.iendsWith(".zip")) {
Decode::ZIP archive;
if(archive.open(location)) {
for(auto& file : archive.file) {
if(file.name.iendsWith(".bso")) {
rso = archive.extract(file);
break;
}
}
}
if(!rso) rso = file::read(path("gamesettings", location, ".bso"));
} else {
rso = file::read(path("gamesettings", location, ".bso"));
}
if(rso) {
int i = 0;
int v = 0;
int c = -1;
int n = 0;
while (i < rso.size()) {
v = rso[i];
if ((v >= 'a' && v <= 'z') || (v >= 'A' && v <= 'Z')) {
c = v;
} else if (c > -1 && v >= '0' && v <= '9') {
n = (n * 10) + (v - '0');
if (i+1 == rso.size() || rso[i+1] < '0' || rso[i+1] > '9') {
switch (c) {
case 'p': //pixelAspectCorrect 0:off 1:on
settings.video.aspectCorrection = n == 1;
emulator->configure("Video/AspectCorrection", settings.video.aspectCorrection);
break;
case 'o': //overscan 0:216 1:224 (2:240 3:240f)
settings.video.overscan = n == 1;
emulator->configure("Video/Overscan", settings.video.overscan);
break;
case 'w': //widescreenMode 0:none 1:on 2:mode7
settings.emulator.hack.ppu.mode7.wsMode = n == 1 ? 2 : (n == 2 ? 1 : 0);
emulator->configure("Hacks/PPU/Mode7/WsMode", settings.emulator.hack.ppu.mode7.wsMode);
break;
case 'W': //WSaspectRatio int [<=200:wsExt, >200:ar]
settings.emulator.hack.ppu.mode7.widescreen = n;
emulator->configure("Hacks/PPU/Mode7/Widescreen", settings.emulator.hack.ppu.mode7.widescreen);
break;
case 's': //WSsprites 0:safe 1:unsafe 2:clip
settings.emulator.hack.ppu.mode7.wsobj = n == 1 ? 1 : (n == 2 ? 3 : 0);
emulator->configure("Hacks/PPU/Mode7/Wsobj", settings.emulator.hack.ppu.mode7.wsobj);
break;
case 'i': //igwin 0:none 1:outside 2:outside&always 3:all
settings.emulator.hack.ppu.mode7.igwin = n > 3 ? 0 : n;
emulator->configure("Hacks/PPU/Mode7/Igwin", settings.emulator.hack.ppu.mode7.igwin);
break;
case 'I': //igwinx int
settings.emulator.hack.ppu.mode7.igwinx = n > 255 ? 128 : n;
emulator->configure("Hacks/PPU/Mode7/Igwinx", settings.emulator.hack.ppu.mode7.igwinx);
break;
case 'b': //bg1WS 0:off 1:on 2:auto(h+v)
settings.emulator.hack.ppu.mode7.wsbg1 = n == 1 ? 1 : (n == 2 ? 16 : 0);
emulator->configure("Hacks/PPU/Mode7/Wsbg1", settings.emulator.hack.ppu.mode7.wsbg1);
break;
case 'B': //bg2WS 0:off 1:on 2:auto(h+v)
settings.emulator.hack.ppu.mode7.wsbg2 = n == 1 ? 1 : (n == 2 ? 16 : 0);
emulator->configure("Hacks/PPU/Mode7/Wsbg2", settings.emulator.hack.ppu.mode7.wsbg2);
break;
case 'c': //bg3WS 0:off 1:on 2:auto(h+v)
settings.emulator.hack.ppu.mode7.wsbg3 = n == 1 ? 1 : (n == 2 ? 16 : 0);
emulator->configure("Hacks/PPU/Mode7/Wsbg3", settings.emulator.hack.ppu.mode7.wsbg3);
break;
case 'C': //bg4WS 0:off 1:on 2:auto(h+v)
settings.emulator.hack.ppu.mode7.wsbg4 = n == 1 ? 1 : (n == 2 ? 16 : 0);
emulator->configure("Hacks/PPU/Mode7/Wsbg4", settings.emulator.hack.ppu.mode7.wsbg4);
break;
}
c = -1;
n = 0;
}
}
i++;
}
}
return true;
}

View file

@ -71,24 +71,6 @@ auto Program::hackCompatibility() -> void {
emulator->configure("Hacks/PPU/Fast", fastPPU);
emulator->configure("Hacks/PPU/NoSpriteLimit", fastPPUNoSpriteLimit);
emulator->configure("Hacks/PPU/RenderCycle", renderCycle);
emulator->configure("Hacks/PPU/Mode7/Scale", settings.emulator.hack.ppu.mode7.scale);
emulator->configure("Hacks/PPU/Mode7/Perspective", settings.emulator.hack.ppu.mode7.perspective);
emulator->configure("Hacks/PPU/Mode7/Widescreen", settings.emulator.hack.ppu.mode7.widescreen);
emulator->configure("Hacks/PPU/Mode7/Wsbg1", settings.emulator.hack.ppu.mode7.wsbg1);
emulator->configure("Hacks/PPU/Mode7/Wsbg2", settings.emulator.hack.ppu.mode7.wsbg2);
emulator->configure("Hacks/PPU/Mode7/Wsbg3", settings.emulator.hack.ppu.mode7.wsbg3);
emulator->configure("Hacks/PPU/Mode7/Wsbg4", settings.emulator.hack.ppu.mode7.wsbg4);
emulator->configure("Hacks/PPU/Mode7/Wsobj", settings.emulator.hack.ppu.mode7.wsobj);
emulator->configure("Hacks/PPU/Mode7/Igwin", settings.emulator.hack.ppu.mode7.igwin);
emulator->configure("Hacks/PPU/Mode7/Igwinx", settings.emulator.hack.ppu.mode7.igwinx);
emulator->configure("Hacks/PPU/Mode7/BgGrad", settings.emulator.hack.ppu.mode7.bgGrad);
emulator->configure("Hacks/PPU/Mode7/WindRad", settings.emulator.hack.ppu.mode7.windRad);
emulator->configure("Hacks/PPU/Mode7/WsMode", settings.emulator.hack.ppu.mode7.wsMode);
emulator->configure("Hacks/PPU/Mode7/WsBgCol", settings.emulator.hack.ppu.mode7.wsBgCol);
emulator->configure("Hacks/PPU/Mode7/WsMarker", settings.emulator.hack.ppu.mode7.wsMarker);
emulator->configure("Hacks/PPU/Mode7/WsMarkerAlpha", settings.emulator.hack.ppu.mode7.wsMarkerAlpha);
emulator->configure("Hacks/PPU/Mode7/Supersample", settings.emulator.hack.ppu.mode7.supersample);
emulator->configure("Hacks/PPU/Mode7/Mosaic", settings.emulator.hack.ppu.mode7.mosaic);
emulator->configure("Hacks/DSP/Fast", fastDSP);
emulator->configure("Hacks/DSP/Cubic", settings.emulator.hack.dsp.cubic);
emulator->configure("Hacks/Coprocessor/DelayedSync", coprocessorDelayedSync);

View file

@ -18,13 +18,13 @@ struct Settings : Markup::Node {
uint luminance = 100;
uint saturation = 100;
uint gamma = 150;
uint gamma = 100;
bool dimming = true;
bool snow = false;
string output = "Scale";
uint multiplier = 2;
bool aspectCorrection = true;
bool aspectCorrection = false;
bool overscan = false;
bool blur = false;
string filter = "None";

View file

@ -724,7 +724,7 @@ static void set_environment_info(retro_environment_t cb)
{ "bsnes_mode7_bgGrad", "HD Background Color Radius; 4|5|6|7|8|0|1|2|3" },
{ "bsnes_mode7_windRad", "HD Windowing (experimental); 0|1|2|3|4|5|6|7|8" },
{ "bsnes_ppu_show_overscan", "Show Overscan; OFF|ON" },
{ "bsnes_video_aspectcorrection", "Aspect Correction; OFF|ON" },
{ "bsnes_video_aspectcorrection", "Pixel Aspect Correction; OFF|ON" },
{ "bsnes_blur_emulation", "Blur emulation; OFF|ON" },
{ "bsnes_entropy", "Entropy (randomization); Low|High|None" },
{ "bsnes_hotfixes", "Hotfixes; OFF|ON" },
@ -745,7 +745,7 @@ static void set_environment_info(retro_environment_t cb)
{ "bsnes_run_ahead_frames", "Amount of frames for run-ahead; OFF|1|2|3|4" },
{ "bsnes_video_luminance", "Luminance; 100|90|80|70|60|50|40|30|20|10|0" },
{ "bsnes_video_saturation", "Saturation; 100|90|80|70|60|50|40|30|20|10|0|200|190|180|170|160|150|140|130|120|110" },
{ "bsnes_video_gamma", "Gamma; 150|140|130|120|110|100|200|190|180|170|160" },
{ "bsnes_video_gamma", "Gamma; 100|110|120|130|140|150|160|170|180|190|200" },
{ nullptr },
};
cb(RETRO_ENVIRONMENT_SET_VARIABLES, const_cast<retro_variable *>(vars));

BIN
packraw.zip Normal file

Binary file not shown.