Skip to content

Commit ae5d380

Browse files
committed
Update to v098r11 release.
byuu says: Changelog: - fixed nall/path.hpp compilation issue - fixed ruby/audio/xaudio header declaration compilation issue (again) - cleaned up xaudio2.hpp file to match my coding syntax (12.5% of the file was whitespace overkill) - added null terminator entry to nall/windows/utf8.hpp argc[] array - nall/windows/guid.hpp uses the Windows API for generating the GUID - this should stop all the bug reports where two nall users were generating GUIDs at the exact same second - fixed hiro/cocoa compilation issue with uint# types - fixed major higan/sfc Super Game Boy audio latency issue - fixed higan/sfc CPU core bug with pei, [dp], [dp]+y instructions - major cleanups to higan/processor/r65816 core - merged emulation/native-mode opcodes - use camel-case naming on memory.hpp functions - simplify address masking code for memory.hpp functions - simplify a few opcodes themselves (avoid redundant copies, etc) - rename regs.* to r.* to match modern convention of other CPU cores - removed device.order<> concept from Emulator::Interface - cores will now do the translation to make the job of the UI easier - fixed plurality naming of arrays in Emulator::Interface - example: emulator.ports[p].devices[d].inputs[i] - example: vector<Medium> media - probably more surprises Major show-stoppers to the next official release: - we need to work on GB core improvements: LY=153/0 case, multiple STAT IRQs case, GBC audio output regs, etc. - we need to re-add software cursors for light guns (Super Scope, Justifier) - after the above, we need to fix the turbo button for the Super Scope I really have no idea how I want to implement the light guns. Ideally, we'd want it in higan/video, so we can support the NES Zapper with the same code. But this isn't going to be easy, because only the SNES knows when its output is interlaced, and its resolutions can vary as {256,512}x{224,240,448,480} which requires pixel doubling that was hard-coded to the SNES-specific behavior, but isn't appropriate to be exposed in higan/video.
1 parent 3ebc77c commit ae5d380

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+1678
-1954
lines changed

higan/emulator/emulator.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ using namespace nall;
88

99
namespace Emulator {
1010
static const string Name = "higan";
11-
static const string Version = "098.10";
11+
static const string Version = "098.11";
1212
static const string Author = "byuu";
1313
static const string License = "GPLv3";
1414
static const string Website = "http://byuu.org/";

higan/emulator/interface.hpp

+5-6
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ struct Interface {
1717
} capability;
1818
} information;
1919

20-
struct Media {
20+
struct Medium {
2121
uint id;
2222
string name;
2323
string type;
2424
bool bootable; //false for cartridge slots (eg Sufami Turbo cartridges)
2525
};
26-
vector<Media> media;
26+
vector<Medium> media;
2727

2828
struct Device {
2929
uint id;
@@ -35,16 +35,15 @@ struct Interface {
3535
string name;
3636
uintptr guid; //user data field
3737
};
38-
vector<Input> input;
39-
vector<uint> order;
38+
vector<Input> inputs;
4039
};
4140

4241
struct Port {
4342
uint id;
4443
string name;
45-
vector<Device> device;
44+
vector<Device> devices;
4645
};
47-
vector<Port> port;
46+
vector<Port> ports;
4847

4948
struct Bind {
5049
virtual auto loadRequest(uint, string, string, bool) -> void {}

higan/fc/input/input.cpp

+5-2
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,23 @@ auto Input::latch(bool data) -> void {
1515
}
1616

1717
auto Input::data(bool port) -> bool {
18+
//table to convert native button ordering to Emulator::Interface ordering
19+
static const uint lookup[] = {5, 4, 6, 7, 0, 1, 2, 3};
20+
1821
bool result = 0;
1922

2023
if(port == 0) {
2124
if(port1 == Device::Joypad) {
2225
if(counter1 >= 8) return 1;
23-
result = interface->inputPoll(0, 0u, counter1);
26+
result = interface->inputPoll(0, 0u, lookup[counter1]);
2427
if(latchdata == 0) counter1++;
2528
}
2629
}
2730

2831
if(port == 1) {
2932
if(port2 == Device::Joypad) {
3033
if(counter2 >= 8) return 1;
31-
result = interface->inputPoll(1, 0u, counter2);
34+
result = interface->inputPoll(1, 0u, lookup[counter2]);
3235
if(latchdata == 0) counter2++;
3336
}
3437
}

higan/fc/interface/interface.cpp

+17-18
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,24 @@ Interface::Interface() {
2222
media.append({ID::Famicom, "Famicom", "fc", true});
2323

2424
{ Device device{0, ID::Port1 | ID::Port2, "Controller"};
25-
device.input.append({0, 0, "A" });
26-
device.input.append({1, 0, "B" });
27-
device.input.append({2, 0, "Select"});
28-
device.input.append({3, 0, "Start" });
29-
device.input.append({4, 0, "Up" });
30-
device.input.append({5, 0, "Down" });
31-
device.input.append({6, 0, "Left" });
32-
device.input.append({7, 0, "Right" });
33-
device.order = {4, 5, 6, 7, 1, 0, 2, 3};
34-
this->device.append(device);
25+
device.inputs.append({0, 0, "Up" });
26+
device.inputs.append({1, 0, "Down" });
27+
device.inputs.append({2, 0, "Left" });
28+
device.inputs.append({3, 0, "Right" });
29+
device.inputs.append({4, 0, "B" });
30+
device.inputs.append({5, 0, "A" });
31+
device.inputs.append({6, 0, "Select"});
32+
device.inputs.append({7, 0, "Start" });
33+
devices.append(device);
3534
}
3635

37-
port.append({0, "Port 1"});
38-
port.append({1, "Port 2"});
36+
ports.append({0, "Port 1"});
37+
ports.append({1, "Port 2"});
3938

40-
for(auto& device : this->device) {
41-
for(auto& port : this->port) {
39+
for(auto& device : devices) {
40+
for(auto& port : ports) {
4241
if(device.portmask & (1 << port.id)) {
43-
port.device.append(device);
42+
port.devices.append(device);
4443
}
4544
}
4645
}
@@ -98,14 +97,14 @@ auto Interface::videoColor(uint32 n) -> uint64 {
9897
v *= brightness / 12.0;
9998

10099
y += v;
101-
i += v * std::cos((3.141592653 / 6.0) * (p + hue));
102-
q += v * std::sin((3.141592653 / 6.0) * (p + hue));
100+
i += v * cos((3.141592653 / 6.0) * (p + hue));
101+
q += v * sin((3.141592653 / 6.0) * (p + hue));
103102
}
104103

105104
i *= saturation;
106105
q *= saturation;
107106

108-
auto gammaAdjust = [=](double f) { return f < 0.0 ? 0.0 : std::pow(f, 2.2 / gamma); };
107+
auto gammaAdjust = [=](double f) { return f < 0.0 ? 0.0 : pow(f, 2.2 / gamma); };
109108
uint64 r = uclamp<16>(65535.0 * gammaAdjust(y + 0.946882 * i + 0.623557 * q));
110109
uint64 g = uclamp<16>(65535.0 * gammaAdjust(y + -0.274788 * i + -0.635691 * q));
111110
uint64 b = uclamp<16>(65535.0 * gammaAdjust(y + -1.108545 * i + 1.709007 * q));

higan/fc/interface/interface.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ struct Interface : Emulator::Interface {
5555
auto set(const string& name, const any& value) -> bool override;
5656

5757
private:
58-
vector<Device> device;
58+
vector<Device> devices;
5959
};
6060

6161
struct Settings {

higan/gb/interface/interface.cpp

+10-11
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,18 @@ Interface::Interface() {
2525

2626
{
2727
Device device{0, ID::Device, "Controller"};
28-
device.input.append({0, 0, "Up" });
29-
device.input.append({1, 0, "Down" });
30-
device.input.append({2, 0, "Left" });
31-
device.input.append({3, 0, "Right" });
32-
device.input.append({4, 0, "B" });
33-
device.input.append({5, 0, "A" });
34-
device.input.append({6, 0, "Select"});
35-
device.input.append({7, 0, "Start" });
36-
device.order = {0, 1, 2, 3, 4, 5, 6, 7};
37-
this->device.append(device);
28+
device.inputs.append({0, 0, "Up" });
29+
device.inputs.append({1, 0, "Down" });
30+
device.inputs.append({2, 0, "Left" });
31+
device.inputs.append({3, 0, "Right" });
32+
device.inputs.append({4, 0, "B" });
33+
device.inputs.append({5, 0, "A" });
34+
device.inputs.append({6, 0, "Select"});
35+
device.inputs.append({7, 0, "Start" });
36+
devices.append(device);
3837
}
3938

40-
port.append({0, "Device", {device[0]}});
39+
ports.append({0, "Device", {devices[0]}});
4140
}
4241

4342
auto Interface::manifest() -> string {

higan/gb/interface/interface.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct Interface : Emulator::Interface {
6969
auto joypWrite(bool p15, bool p14) -> void;
7070

7171
private:
72-
vector<Device> device;
72+
vector<Device> devices;
7373
};
7474

7575
struct Settings {

higan/gba/cpu/cpu.cpp

+6-3
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,15 @@ auto CPU::sync_step(uint clocks) -> void {
9191
}
9292

9393
auto CPU::keypad_run() -> void {
94-
if(regs.keypad.control.enable == false) return;
94+
//lookup table to convert button indexes to Emulator::Interface indexes
95+
static const uint lookup[] = {5, 4, 8, 9, 3, 2, 0, 1, 7, 6};
96+
97+
if(!regs.keypad.control.enable) return;
9598

9699
bool test = regs.keypad.control.condition; //0 = OR, 1 = AND
97100
for(auto n : range(10)) {
98-
if(regs.keypad.control.flag[n] == false) continue;
99-
bool input = interface->inputPoll(0, 0, n);
101+
if(!regs.keypad.control.flag[n]) continue;
102+
bool input = interface->inputPoll(0, 0, lookup[n]);
100103
if(regs.keypad.control.condition == 0) test |= input;
101104
if(regs.keypad.control.condition == 1) test &= input;
102105
}

higan/gba/cpu/mmio.cpp

+4-3
Original file line numberDiff line numberDiff line change
@@ -61,18 +61,19 @@ auto CPU::read(uint32 addr) -> uint8 {
6161

6262
//KEYINPUT
6363
case 0x04000130: {
64+
static const uint lookup[] = {5, 4, 8, 9, 3, 2, 0, 1};
6465
if(auto result = player.keyinput()) return result() >> 0;
6566
uint8 result = 0;
66-
for(uint n = 0; n < 8; n++) result |= interface->inputPoll(0, 0, n) << n;
67+
for(uint n = 0; n < 8; n++) result |= interface->inputPoll(0, 0, lookup[n]) << n;
6768
if((result & 0xc0) == 0xc0) result &= (uint8)~0xc0; //up+down cannot be pressed simultaneously
6869
if((result & 0x30) == 0x30) result &= (uint8)~0x30; //left+right cannot be pressed simultaneously
6970
return result ^ 0xff;
7071
}
7172
case 0x04000131: {
7273
if(auto result = player.keyinput()) return result() >> 8;
7374
uint8 result = 0;
74-
result |= interface->inputPoll(0, 0, 8) << 0;
75-
result |= interface->inputPoll(0, 0, 9) << 1;
75+
result |= interface->inputPoll(0, 0, 7) << 0;
76+
result |= interface->inputPoll(0, 0, 6) << 1;
7677
return result ^ 0x03;
7778
}
7879

higan/gba/interface/interface.cpp

+15-16
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,21 @@ Interface::Interface() {
2222
media.append({ID::GameBoyAdvance, "Game Boy Advance", "gba", true});
2323

2424
{ Device device{0, ID::Device, "Controller"};
25-
device.input.append({ 0, 0, "A" });
26-
device.input.append({ 1, 0, "B" });
27-
device.input.append({ 2, 0, "Select"});
28-
device.input.append({ 3, 0, "Start" });
29-
device.input.append({ 4, 0, "Right" });
30-
device.input.append({ 5, 0, "Left" });
31-
device.input.append({ 6, 0, "Up" });
32-
device.input.append({ 7, 0, "Down" });
33-
device.input.append({ 8, 0, "R" });
34-
device.input.append({ 9, 0, "L" });
35-
device.input.append({10, 2, "Rumble"});
36-
device.order = {6, 7, 5, 4, 1, 0, 9, 8, 2, 3, 10};
37-
this->device.append(device);
38-
}
39-
40-
port.append({0, "Device", {device[0]}});
25+
device.inputs.append({ 0, 0, "Up" });
26+
device.inputs.append({ 1, 0, "Down" });
27+
device.inputs.append({ 2, 0, "Left" });
28+
device.inputs.append({ 3, 0, "Right" });
29+
device.inputs.append({ 4, 0, "B" });
30+
device.inputs.append({ 5, 0, "A" });
31+
device.inputs.append({ 6, 0, "L" });
32+
device.inputs.append({ 7, 0, "R" });
33+
device.inputs.append({ 8, 0, "Select"});
34+
device.inputs.append({ 9, 0, "Start" });
35+
device.inputs.append({10, 2, "Rumble"});
36+
devices.append(device);
37+
}
38+
39+
ports.append({0, "Device", {devices[0]}});
4140
}
4241

4342
auto Interface::manifest() -> string {

higan/gba/interface/interface.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ struct Interface : Emulator::Interface {
5252
auto set(const string& name, const any& value) -> bool override;
5353

5454
private:
55-
vector<Device> device;
55+
vector<Device> devices;
5656
};
5757

5858
struct Settings {

0 commit comments

Comments
 (0)