mirror of
https://github.com/libretro/bsnes-libretro.git
synced 2024-11-23 08:59:40 +00:00
Update to v103r23 release.
byuu says: Changelog: - gb: added accelerometer X-axis, Y-Axis inputs¹ - gb: added rumble input¹ - gb/mbc5: added rumble support² - gb/mbc6: added skeleton driver, but it doesn't boot Net de Get - gb/mbc7: added mostly complete driver (only missing EEPROM), but it doesn't boot Kirby Tilt 'n' Tumble - gb/tama: added leap year assignment - tomoko: fixed macOS compilation [MerryMage] - hiro/cocoa: fix table cell redrawing on updates and automatic column resizing [ncbncb] - hiro/cocoa: fix some weird issue with clicking table view checkboxes on Retina displays [ncbncb] - icarus: enhance Game Boy heuristics³ - nall: fix three missing return statements [Jonas Quinn] - ruby: hopefully fixed all compilation errors reported by Screwtape et al⁴ ¹: because there's no concept of a controller for cartridge inputs, I'm attaching to the base platform for now. An idea I had was to make separate ports for each cartridge type ... but this would duplicate the rumble input between MBC5 and MBC7. And would also be less discoverable. But it would be more clean in that users wouldn't think the Game Boy hardware had this functionality. I'll think about it. ²: it probably won't work yet. Rumble isn't documented anywhere, but I dug through an emulator named GEST and discovered that it seems to use bit 3 of the RAM bank select to be rumble. I don't know if it sets the bit for rumbling, then clears when finished, or if it sets it and then after a few milliseconds it stops rumbling. I couldn't test on my FreeBSD box because SDL 1.2 doesn't support rumble, udev doesn't exist on FreeBSD, and nobody has ever posted any working code for how to use evdev (or whatever it's called) on FreeBSD. ³: I'm still thinking about specifying the MBC7 RAM as EEPROM, since it's not really static RAM. ⁴: if possible, please test all drivers if you can. I want to ensure they're all working. Especially let me know if the following work: macOS: input.carbon Linux: audio.pulseaudiosimple, audio.ao (libao) If I can confirm these are working, I'm going to then remove them from being included with stock higan builds. I'm also considering dropping SDL video on Linux/BSD. XShm is much faster and supports blurring. I may also drop SDL input on Linux, since udev works better. That will free a dependency on SDL 1.2 for building higan. FreeBSD is still going to need it for joypad support, however.
This commit is contained in:
parent
e1223366a7
commit
7022d1aa51
@ -12,7 +12,7 @@ using namespace nall;
|
||||
|
||||
namespace Emulator {
|
||||
static const string Name = "higan";
|
||||
static const string Version = "103.22";
|
||||
static const string Version = "103.23";
|
||||
static const string Author = "byuu";
|
||||
static const string License = "GPLv3";
|
||||
static const string Website = "http://byuu.org/";
|
||||
|
@ -9,6 +9,8 @@ Cartridge cartridge;
|
||||
#include "mbc2/mbc2.cpp"
|
||||
#include "mbc3/mbc3.cpp"
|
||||
#include "mbc5/mbc5.cpp"
|
||||
#include "mbc6/mbc6.cpp"
|
||||
#include "mbc7/mbc7.cpp"
|
||||
#include "mmm01/mmm01.cpp"
|
||||
#include "huc1/huc1.cpp"
|
||||
#include "huc3/huc3.cpp"
|
||||
@ -51,10 +53,16 @@ auto Cartridge::load() -> bool {
|
||||
if(mapperID == "MBC2" ) mapper = &mbc2;
|
||||
if(mapperID == "MBC3" ) mapper = &mbc3;
|
||||
if(mapperID == "MBC5" ) mapper = &mbc5;
|
||||
if(mapperID == "MBC6" ) mapper = &mbc6;
|
||||
if(mapperID == "MBC7" ) mapper = &mbc7;
|
||||
if(mapperID == "MMM01") mapper = &mmm01;
|
||||
if(mapperID == "HuC1" ) mapper = &huc1;
|
||||
if(mapperID == "HuC3" ) mapper = &huc3;
|
||||
if(mapperID == "TAMA" ) mapper = &tama;
|
||||
if(!mapper) mapper = &mbc0;
|
||||
|
||||
accelerometer = (bool)document["board/accelerometer"];
|
||||
rumble = (bool)document["board/rumble"];
|
||||
|
||||
rom.size = max(0x4000, document["board/rom/size"].natural());
|
||||
rom.data = (uint8*)memory::allocate(rom.size, 0xff);
|
||||
|
@ -42,6 +42,8 @@ private:
|
||||
virtual auto serialize(serializer&) -> void = 0;
|
||||
};
|
||||
Mapper* mapper = nullptr;
|
||||
bool accelerometer = false;
|
||||
bool rumble = false;
|
||||
|
||||
#include "mbc0/mbc0.hpp"
|
||||
#include "mbc1/mbc1.hpp"
|
||||
@ -49,6 +51,8 @@ private:
|
||||
#include "mbc2/mbc2.hpp"
|
||||
#include "mbc3/mbc3.hpp"
|
||||
#include "mbc5/mbc5.hpp"
|
||||
#include "mbc6/mbc6.hpp"
|
||||
#include "mbc7/mbc7.hpp"
|
||||
#include "mmm01/mmm01.hpp"
|
||||
#include "huc1/huc1.hpp"
|
||||
#include "huc3/huc3.hpp"
|
||||
|
@ -32,6 +32,7 @@ auto Cartridge::MBC5::write(uint16 address, uint8 data) -> void {
|
||||
}
|
||||
|
||||
if((address & 0xe000) == 0x4000) { //$4000-5fff
|
||||
if(cartridge.rumble) platform->inputRumble(ID::Port::Hardware, ID::Device::Controls, 10, data.bit(3));
|
||||
io.ram.bank = data.bits(0,3);
|
||||
return;
|
||||
}
|
||||
|
25
higan/gb/cartridge/mbc6/mbc6.cpp
Normal file
25
higan/gb/cartridge/mbc6/mbc6.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
auto Cartridge::MBC6::read(uint16 address) -> uint8 {
|
||||
if((address & 0xc000) == 0x0000) { //$0000-3fff
|
||||
return cartridge.rom.read(address.bits(0,13));
|
||||
}
|
||||
|
||||
if((address & 0xc000) == 0x4000) { //$4000-7fff
|
||||
return cartridge.rom.read(io.rom.bank << 14 | address.bits(0,13));
|
||||
}
|
||||
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
auto Cartridge::MBC6::write(uint16 address, uint8 data) -> void {
|
||||
if((address & 0xf000) == 0x2000) { //$2000-2fff
|
||||
io.rom.bank = data;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
auto Cartridge::MBC6::power() -> void {
|
||||
io = {};
|
||||
}
|
||||
|
||||
auto Cartridge::MBC6::serialize(serializer& s) -> void {
|
||||
}
|
12
higan/gb/cartridge/mbc6/mbc6.hpp
Normal file
12
higan/gb/cartridge/mbc6/mbc6.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
struct MBC6 : Mapper {
|
||||
auto read(uint16 address) -> uint8;
|
||||
auto write(uint16 address, uint8 data) -> void;
|
||||
auto power() -> void;
|
||||
auto serialize(serializer&) -> void;
|
||||
|
||||
struct IO {
|
||||
struct ROM {
|
||||
uint8 bank = 0x01;
|
||||
} rom;
|
||||
} io;
|
||||
} mbc6;
|
81
higan/gb/cartridge/mbc7/mbc7.cpp
Normal file
81
higan/gb/cartridge/mbc7/mbc7.cpp
Normal file
@ -0,0 +1,81 @@
|
||||
auto Cartridge::MBC7::read(uint16 address) -> uint8 {
|
||||
if((address & 0xc000) == 0x0000) { //$0000-3fff
|
||||
return cartridge.rom.read(address.bits(0,13));
|
||||
}
|
||||
|
||||
if((address & 0xc000) == 0x0000) { //$4000-7fff
|
||||
return cartridge.rom.read(io.rom.bank << 14 | address.bits(0,13));
|
||||
}
|
||||
|
||||
if((address & 0xf000) == 0xa000) { //$a000-afff
|
||||
if(!io.ram.enable[0] || !io.ram.enable[1]) return 0xff;
|
||||
|
||||
switch(address.bits(4,7)) {
|
||||
case 2: return io.accelerometer.x.bits(0, 7);
|
||||
case 3: return io.accelerometer.x.bits(8,15);
|
||||
case 4: return io.accelerometer.y.bits(0, 7);
|
||||
case 5: return io.accelerometer.y.bits(8,15);
|
||||
case 6: return io.accelerometer.z.bits(0, 7);
|
||||
case 7: return io.accelerometer.z.bits(8,15);
|
||||
case 8: return 0xff;
|
||||
}
|
||||
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
return 0xff;
|
||||
}
|
||||
|
||||
auto Cartridge::MBC7::write(uint16 address, uint8 data) -> void {
|
||||
if((address & 0xe000) == 0x0000) { //$0000-1fff
|
||||
io.ram.enable[0] = data.bits(0,3) == 0xa;
|
||||
if(!io.ram.enable[0]) io.ram.enable[1] = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if((address & 0xe000) == 0x2000) { //$2000-3fff
|
||||
io.rom.bank = data;
|
||||
if(!io.rom.bank) io.rom.bank = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if((address & 0xe000) == 0x4000) { //$4000-5fff
|
||||
if(!io.ram.enable[0]) return;
|
||||
io.ram.enable[1] = data == 0x40;
|
||||
}
|
||||
|
||||
if((address & 0xf000) == 0xa000) { //$a000-afff
|
||||
if(!io.ram.enable[0] || !io.ram.enable[1]) return;
|
||||
|
||||
switch(address.bits(4,7)) {
|
||||
|
||||
case 0: {
|
||||
if(data != 0x55) break;
|
||||
io.accelerometer.x = 0x8000;
|
||||
io.accelerometer.y = 0x8000;
|
||||
break;
|
||||
}
|
||||
|
||||
case 1: {
|
||||
if(data != 0xaa) break;
|
||||
io.accelerometer.x = 0x8000 + platform->inputPoll(ID::Port::Hardware, ID::Device::Controls, 8);
|
||||
io.accelerometer.y = 0x8000 + platform->inputPoll(ID::Port::Hardware, ID::Device::Controls, 9);
|
||||
break;
|
||||
}
|
||||
|
||||
case 8: {
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
auto Cartridge::MBC7::power() -> void {
|
||||
io = {};
|
||||
}
|
||||
|
||||
auto Cartridge::MBC7::serialize(serializer& s) -> void {
|
||||
}
|
20
higan/gb/cartridge/mbc7/mbc7.hpp
Normal file
20
higan/gb/cartridge/mbc7/mbc7.hpp
Normal file
@ -0,0 +1,20 @@
|
||||
struct MBC7 : Mapper {
|
||||
auto read(uint16 address) -> uint8;
|
||||
auto write(uint16 address, uint8 data) -> void;
|
||||
auto power() -> void;
|
||||
auto serialize(serializer&) -> void;
|
||||
|
||||
struct IO {
|
||||
struct ROM {
|
||||
uint8 bank = 0x01;
|
||||
} rom;
|
||||
struct RAM {
|
||||
uint1 enable[2];
|
||||
} ram;
|
||||
struct Accelerometer {
|
||||
uint16 x = 0x8000;
|
||||
uint16 y = 0x8000;
|
||||
uint16 z = 0xff00; //unused
|
||||
} accelerometer;
|
||||
} io;
|
||||
} mbc7;
|
@ -183,6 +183,10 @@ auto Cartridge::TAMA::write(uint16 address, uint8 data) -> void {
|
||||
rtc.second = 0; //hack: unclear where this is really being set (if it is at all)
|
||||
}
|
||||
|
||||
if(io.mode == 4 && io.index == 0x02 && io.input.bits(0,3) == 0xb) {
|
||||
rtc.leapYear = data.bits(4,5);
|
||||
}
|
||||
|
||||
if(io.mode == 4 && io.index == 0x02 && io.input.bits(0,3) == 0xe) {
|
||||
rtc.test = io.input.bits(4,7);
|
||||
}
|
||||
|
@ -19,6 +19,9 @@ Interface::Interface() {
|
||||
device.inputs.append({0, "A" });
|
||||
device.inputs.append({0, "Select"});
|
||||
device.inputs.append({0, "Start" });
|
||||
device.inputs.append({1, "X-axis"});
|
||||
device.inputs.append({1, "Y-axis"});
|
||||
device.inputs.append({2, "Rumble"});
|
||||
hardwarePort.devices.append(device);
|
||||
}
|
||||
|
||||
|
@ -169,12 +169,10 @@ Presentation::Presentation() {
|
||||
#endif
|
||||
|
||||
#if defined(PLATFORM_MACOSX)
|
||||
showConfigurationSeparator.setVisible(false);
|
||||
showConfiguration.setVisible(false);
|
||||
about.setVisible(false);
|
||||
Application::Cocoa::onAbout([&] { about.doActivate(); });
|
||||
Application::Cocoa::onActivate([&] { setFocused(); });
|
||||
Application::Cocoa::onPreferences([&] { showConfiguration.doActivate(); });
|
||||
Application::Cocoa::onPreferences([&] { showInputSettings.doActivate(); });
|
||||
Application::Cocoa::onQuit([&] { doClose(); });
|
||||
#endif
|
||||
}
|
||||
|
@ -9,29 +9,31 @@ auto pTableViewCell::destruct() -> void {
|
||||
}
|
||||
|
||||
auto pTableViewCell::setAlignment(Alignment alignment) -> void {
|
||||
_redraw();
|
||||
}
|
||||
|
||||
auto pTableViewCell::setBackgroundColor(Color color) -> void {
|
||||
_redraw();
|
||||
}
|
||||
|
||||
auto pTableViewCell::setCheckable(bool checkable) -> void {
|
||||
_redraw();
|
||||
}
|
||||
|
||||
auto pTableViewCell::setChecked(bool checked) -> void {
|
||||
_redraw();
|
||||
}
|
||||
|
||||
auto pTableViewCell::setForegroundColor(Color color) -> void {
|
||||
_redraw();
|
||||
}
|
||||
|
||||
auto pTableViewCell::setIcon(const image& icon) -> void {
|
||||
_redraw();
|
||||
}
|
||||
|
||||
auto pTableViewCell::setText(const string& text) -> void {
|
||||
@autoreleasepool {
|
||||
if(auto pTableView = _grandparent()) {
|
||||
[[pTableView->cocoaView content] reloadData];
|
||||
}
|
||||
}
|
||||
_redraw();
|
||||
}
|
||||
|
||||
auto pTableViewCell::_grandparent() -> maybe<pTableView&> {
|
||||
@ -45,6 +47,19 @@ auto pTableViewCell::_parent() -> maybe<pTableViewItem&> {
|
||||
return nothing;
|
||||
}
|
||||
|
||||
auto pTableViewCell::_redraw() -> void {
|
||||
@autoreleasepool {
|
||||
if(auto pTableViewItem = _parent()) {
|
||||
if(auto pTableView = _grandparent()) {
|
||||
auto column = self().offset();
|
||||
auto row = pTableViewItem->self().offset();
|
||||
NSRect rect = [[pTableView->cocoaTableView content] frameOfCellAtColumn:column row:row];
|
||||
[[pTableView->cocoaTableView content] setNeedsDisplayInRect:rect];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -15,6 +15,7 @@ struct pTableViewCell : pObject {
|
||||
|
||||
auto _grandparent() -> maybe<pTableView&>;
|
||||
auto _parent() -> maybe<pTableViewItem&>;
|
||||
auto _redraw() -> void;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -52,6 +52,7 @@
|
||||
[content setFont:font];
|
||||
[content setRowHeight:fontHeight];
|
||||
[self reloadColumns];
|
||||
tableView->resizeColumns();
|
||||
}
|
||||
|
||||
-(void) reloadColumns {
|
||||
@ -214,7 +215,7 @@
|
||||
//needed to trigger trackMouse events
|
||||
-(NSUInteger) hitTestForEvent:(NSEvent*)event inRect:(NSRect)frame ofView:(NSView*)view {
|
||||
NSUInteger hitTest = [super hitTestForEvent:event inRect:frame ofView:view];
|
||||
NSPoint point = [view convertPointFromBase:[event locationInWindow]];
|
||||
NSPoint point = [view convertPoint:[event locationInWindow] fromView:nil];
|
||||
NSRect rect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.height, frame.size.height);
|
||||
if(NSMouseInRect(point, rect, [view isFlipped])) {
|
||||
hitTest |= NSCellHitTrackableArea;
|
||||
@ -230,7 +231,7 @@
|
||||
NSEvent* nextEvent;
|
||||
while((nextEvent = [window nextEventMatchingMask:(NSLeftMouseDragged | NSLeftMouseUp)])) {
|
||||
if([nextEvent type] == NSLeftMouseUp) {
|
||||
NSPoint point = [view convertPointFromBase:[nextEvent locationInWindow]];
|
||||
NSPoint point = [view convertPoint:[nextEvent locationInWindow] fromView:nil];
|
||||
NSRect rect = NSMakeRect(frame.origin.x, frame.origin.y, frame.size.height, frame.size.height);
|
||||
if(NSMouseInRect(point, rect, [view isFlipped])) {
|
||||
if(auto tableViewItem = tableView->item([view rowAtPoint:point])) {
|
||||
@ -279,6 +280,7 @@ auto pTableView::destruct() -> void {
|
||||
auto pTableView::append(sTableViewHeader header) -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView reloadColumns];
|
||||
resizeColumns();
|
||||
|
||||
header->setVisible(header->visible());
|
||||
}
|
||||
@ -293,6 +295,7 @@ auto pTableView::append(sTableViewItem item) -> void {
|
||||
auto pTableView::remove(sTableViewHeader header) -> void {
|
||||
@autoreleasepool {
|
||||
[cocoaView reloadColumns];
|
||||
resizeColumns();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,8 @@ clean:
|
||||
ifeq ($(platform),macosx)
|
||||
@if [ -d out/$(name).app ]; then rm out/$(name).app; fi
|
||||
endif
|
||||
$(call delete,obj/*)
|
||||
$(call delete,out/*)
|
||||
-@$(call delete,obj/*)
|
||||
-@$(call delete,out/*)
|
||||
|
||||
install:
|
||||
ifeq ($(platform),macosx)
|
||||
|
@ -7,12 +7,14 @@ struct GameBoyCartridge {
|
||||
bool clear = false; //cartridge works in CGB mode only
|
||||
|
||||
string mapper = "MBC0";
|
||||
bool flash = false;
|
||||
bool battery = false;
|
||||
bool ram = false;
|
||||
bool rtc = false;
|
||||
bool rumble = false;
|
||||
bool accelerometer = false;
|
||||
bool rumble = false;
|
||||
|
||||
uint flashSize = 0;
|
||||
uint romSize = 0;
|
||||
uint ramSize = 0;
|
||||
uint rtcSize = 0;
|
||||
@ -157,14 +159,17 @@ GameBoyCartridge::GameBoyCartridge(uint8_t* data, uint size) {
|
||||
|
||||
case 0x20:
|
||||
mapper = "MBC6";
|
||||
flash = true;
|
||||
battery = true;
|
||||
ram = true;
|
||||
break;
|
||||
|
||||
case 0x22:
|
||||
mapper = "MBC7";
|
||||
battery = true;
|
||||
ram = true;
|
||||
rumble = true;
|
||||
accelerometer = true;
|
||||
rumble = true;
|
||||
break;
|
||||
|
||||
case 0xfc:
|
||||
@ -204,6 +209,8 @@ GameBoyCartridge::GameBoyCartridge(uint8_t* data, uint size) {
|
||||
case 0x54: romSize = 96 * 16 * 1024; break;
|
||||
}
|
||||
|
||||
if(mapper == "MBC6" && flash) flashSize = 1024 * 1024;
|
||||
|
||||
switch(data[index + 0x0149]) { default:
|
||||
case 0x00: ramSize = 0 * 1024; break;
|
||||
case 0x01: ramSize = 2 * 1024; break;
|
||||
@ -212,13 +219,16 @@ GameBoyCartridge::GameBoyCartridge(uint8_t* data, uint size) {
|
||||
}
|
||||
|
||||
if(mapper == "MBC2" && ram) ramSize = 256;
|
||||
if(mapper == "MBC6" && ram) ramSize = 32 * 1024;
|
||||
if(mapper == "MBC7" && ram) ramSize = 256;
|
||||
if(mapper == "TAMA" && ram) ramSize = 32;
|
||||
|
||||
if(mapper == "MBC3" && rtc) rtcSize = 13;
|
||||
if(mapper == "TAMA" && rtc) rtcSize = 21;
|
||||
|
||||
markup.append("board mapper=", mapper, "\n");
|
||||
markup.append("board mapper=", mapper, accelerometer ? " accelerometer" : "", rumble ? " rumble" : "", "\n");
|
||||
markup.append(" rom name=program.rom size=0x", hex(romSize), "\n");
|
||||
if(flash && flashSize) markup.append(" flash name=download.rom size=0x", hex(flashSize), "\n");
|
||||
if(ram && ramSize) markup.append(" ram ", battery ? "name=save.ram " : "", "size=0x", hex(ramSize), "\n");
|
||||
if(rtc && rtcSize) markup.append(" rtc ", battery ? "name=rtc.ram " : "", "size=0x", hex(rtcSize), "\n");
|
||||
}
|
||||
|
@ -27,6 +27,8 @@ auto image::loadBMP(const uint8_t* bmpData, unsigned bmpSize) -> bool {
|
||||
dp += stride();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
auto image::loadPNG(const string& filename) -> bool {
|
||||
|
@ -35,6 +35,7 @@ struct queue {
|
||||
_write = source._write;
|
||||
source._data = nullptr;
|
||||
source.reset();
|
||||
return *this;
|
||||
}
|
||||
|
||||
~queue() {
|
||||
|
@ -48,6 +48,7 @@ template<typename T> auto string::_prepend(const stringify<T>& source) -> string
|
||||
resize(source.size() + size());
|
||||
memory::move(get() + source.size(), get(), size() - source.size());
|
||||
memory::copy(get(), source.data(), source.size());
|
||||
return *this;
|
||||
}
|
||||
|
||||
template<typename T, typename... P> auto string::append(const T& value, P&&... p) -> string& {
|
||||
|
@ -64,11 +64,11 @@ struct AudioALSA : Audio {
|
||||
}
|
||||
|
||||
if(i < 0) {
|
||||
if(buffer == output) {
|
||||
if(_buffer == output) {
|
||||
_offset--;
|
||||
output++;
|
||||
}
|
||||
memory::move(buffer, output, _offset * sizeof(uint32_t));
|
||||
memory::move(_buffer, output, _offset * sizeof(uint32_t));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,8 @@ struct AudioAO : Audio {
|
||||
}
|
||||
|
||||
auto output(const double samples[]) -> void {
|
||||
uint32_t sample = uint16_t(samples[0] * 32768.0) << 0 | uint16_t(samples[1] * 32768.0) << 0;
|
||||
ao_play(_interface, (char*)&sample, 4); //this may need to be byte swapped for big endian
|
||||
uint32_t sample = uint16_t(samples[0] * 32768.0) << 0 | uint16_t(samples[1] * 32768.0) << 16;
|
||||
ao_play(_interface, (char*)&sample, 4);
|
||||
}
|
||||
|
||||
auto initialize() -> bool {
|
||||
@ -48,8 +48,9 @@ struct AudioAO : Audio {
|
||||
ao_info* information = ao_driver_info(driverID);
|
||||
if(!information) return false;
|
||||
_device = information->short_name;
|
||||
|
||||
ao_option* options = nullptr;
|
||||
if(_device == "alsa") {
|
||||
ao_option* options = nullptr;
|
||||
ao_append_option(&options, "buffer_time", "100000"); //100ms latency (default was 500ms)
|
||||
}
|
||||
|
||||
@ -70,7 +71,7 @@ struct AudioAO : Audio {
|
||||
|
||||
bool _ready = false;
|
||||
string _device = "Default";
|
||||
double _frequency = 48000.0;
|
||||
|
||||
int _driverID;
|
||||
ao_device* _interface = nullptr;
|
||||
};
|
||||
|
@ -109,7 +109,7 @@ private:
|
||||
_buffer = new uint32_t[_period * _rings];
|
||||
_offset = 0;
|
||||
|
||||
if(DirectSoundCreate(0, &_interface, 0) != DS_OK) return term(), false;
|
||||
if(DirectSoundCreate(0, &_interface, 0) != DS_OK) return terminate(), false;
|
||||
_interface->SetCooperativeLevel(GetDesktopWindow(), DSSCL_PRIORITY);
|
||||
|
||||
DSBUFFERDESC primaryDescription = {};
|
||||
|
@ -51,7 +51,7 @@ struct AudioPulseAudio : Audio {
|
||||
pa_mainloop_iterate(_mainLoop, 1, nullptr);
|
||||
}
|
||||
uint length = pa_stream_writable_size(_stream);
|
||||
if(length >= buffer.offset * pa_frame_size(&_specification)) break;
|
||||
if(length >= _offset * pa_frame_size(&_specification)) break;
|
||||
if(!_blocking) {
|
||||
_offset = 0;
|
||||
return;
|
||||
@ -110,7 +110,7 @@ private:
|
||||
_ready = false;
|
||||
|
||||
if(_buffer) {
|
||||
pa_stream_cancel_write(_buffer);
|
||||
pa_stream_cancel_write(_stream);
|
||||
_buffer = nullptr;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <pulse/error.h>
|
||||
|
||||
struct AudioPulseAudioSimple : Audio {
|
||||
AudioPulseAudio() { initialize(); }
|
||||
AudioPulseAudioSimple() { initialize(); }
|
||||
~AudioPulseAudioSimple() { terminate(); }
|
||||
|
||||
auto ready() -> bool { return _ready; }
|
||||
|
@ -27,7 +27,7 @@ private:
|
||||
return _ready = true;
|
||||
}
|
||||
|
||||
auto term() -> void {
|
||||
auto terminate() -> void {
|
||||
_ready = false;
|
||||
_keyboard.terminate();
|
||||
}
|
||||
|
@ -22,13 +22,13 @@ struct InputQuartz : Input {
|
||||
|
||||
auto initialize() -> bool {
|
||||
terminate();
|
||||
if(!_keyboard.init()) return false;
|
||||
if(!_keyboard.initialize()) return false;
|
||||
return _ready = true;
|
||||
}
|
||||
|
||||
auto terminate() -> void {
|
||||
_ready = false;
|
||||
_keyboard.term();
|
||||
_keyboard.terminate();
|
||||
}
|
||||
|
||||
bool _ready = false;
|
||||
|
@ -51,7 +51,7 @@ struct InputUdev : Input {
|
||||
}
|
||||
|
||||
private:
|
||||
auto init() -> bool {
|
||||
auto initialize() -> bool {
|
||||
terminate();
|
||||
if(!_context) return false;
|
||||
if(!_keyboard.initialize()) return false;
|
||||
|
@ -47,7 +47,7 @@ struct VideoCGL : Video, OpenGL {
|
||||
return true;
|
||||
}
|
||||
|
||||
auto setShader(string shader) -> string {
|
||||
auto setShader(string shader) -> bool {
|
||||
if(_shader == shader) return true;
|
||||
OpenGL::shader(_shader = shader);
|
||||
if(!_shader) OpenGL::filter = _smooth ? GL_LINEAR : GL_NEAREST;
|
||||
@ -141,6 +141,7 @@ private:
|
||||
|
||||
RubyVideoCGL* view = nullptr;
|
||||
|
||||
bool _ready = false;
|
||||
NSView* _context = nullptr;
|
||||
bool _blocking = false;
|
||||
bool _smooth = true;
|
||||
|
Loading…
Reference in New Issue
Block a user