Update to v094r01 release.

byuu says:

Changelog:
- port: various compilation fixes for OS X [kode54]
- nall: added programpath() function to return path to process binary
  [todo: need to have ethos use this function]
- ruby: XAudio2 will select default game sound device instead of first
  sound device
- ruby: DirectInput device IDs are no longer ambiguous when VID+PID are
  identical
- ruby: OpenGL won't try and terminate if it hasn't been initialized
- gb: D-pad up+down/left+right not masked in SGB mode
- sfc: rewrote ICD2 video rendering to output in real-time, work with
  cycle-based Game Boy renderer
- sfc: rewrote Bus::reduce(), reduces game loading time by about 500ms
- ethos: store save states in {game}/higan/* instead of {game}/bsnes/*
- loki: added target-loki/ (blank stub for now)
- Makefile: purge out/* on make clean
This commit is contained in:
Tim Allen
2014-01-28 21:04:58 +11:00
parent 10464b8c54
commit 04986d2bf7
32 changed files with 272 additions and 118 deletions

View File

@@ -1,8 +1,3 @@
/*
audio.xaudio2 (2010-08-14)
author: OV2
*/
#include "xaudio2.hpp"
#include <windows.h>
@@ -132,7 +127,19 @@ public:
return false;
}
if(FAILED(hr = pXAudio2->CreateMasteringVoice( &pMasterVoice, 2, settings.frequency, 0, 0 , NULL))) {
unsigned deviceCount = 0;
pXAudio2->GetDeviceCount(&deviceCount);
if(deviceCount == 0) { term(); return false; }
unsigned deviceID = 0;
for(unsigned deviceIndex = 0; deviceIndex < deviceCount; deviceIndex++) {
XAUDIO2_DEVICE_DETAILS deviceDetails;
memset(&deviceDetails, 0, sizeof(XAUDIO2_DEVICE_DETAILS));
pXAudio2->GetDeviceDetails(deviceIndex, &deviceDetails);
if(deviceDetails.Role & DefaultGameDevice) deviceID = deviceIndex;
}
if(FAILED(hr = pXAudio2->CreateMasteringVoice(&pMasterVoice, 2, settings.frequency, 0, deviceID, NULL))) {
return false;
}
@@ -145,7 +152,7 @@ public:
wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
wfx.cbSize = 0;
if(FAILED(hr = pXAudio2->CreateSourceVoice(&pSourceVoice, (WAVEFORMATEX*)&wfx, XAUDIO2_VOICE_NOSRC , XAUDIO2_DEFAULT_FREQ_RATIO, this, NULL, NULL))) {
if(FAILED(hr = pXAudio2->CreateSourceVoice(&pSourceVoice, (WAVEFORMATEX*)&wfx, XAUDIO2_VOICE_NOSRC, XAUDIO2_DEFAULT_FREQ_RATIO, this, NULL, NULL))) {
return false;
}

View File

@@ -35,18 +35,21 @@ struct pInputCarbon {
group.input[inputID].value = value;
}
void poll(vector<HID::Device*>& devices) {
vector<HID::Device*> poll() {
vector<HID::Device*> devices;
KeyMap keymap;
GetKeys(keymap);
uint8_t* buffer = (uint8_t*)keymap;
unsigned inputID = 0;
for(auto& key : keys) {
bool value = buffer[key.id >> 3] & (1 << (key.id & 7)));
bool value = buffer[key.id >> 3] & (1 << (key.id & 7));
assign(kb.hid, HID::Keyboard::GroupID::Button, inputID++, value);
}
devices.append(&kb.hid);
return devices;
}
bool rumble(uint64_t id, bool enable) {

View File

@@ -107,13 +107,9 @@ struct InputJoypadDirectInput {
Joypad jp;
jp.vendorID = instance->guidProduct.Data1 >> 0;
jp.productID = instance->guidProduct.Data1 >> 16;
jp.isXInputDevice = false;
if(auto device = rawinput.find(jp.vendorID, jp.productID)) {
jp.pathID = crc32_calculate((const uint8_t*)device().path.data(), device().path.size());
jp.hid.id = (uint64_t)jp.pathID << 32 | jp.vendorID << 16 | jp.productID << 0;
jp.isXInputDevice = device().isXInputDevice;
} else {
//this should never occur
return DIENUM_CONTINUE;
}
//Microsoft has intentionally imposed artificial restrictions on XInput devices when used with DirectInput
@@ -133,6 +129,17 @@ struct InputJoypadDirectInput {
device->EnumObjects(DirectInput_EnumJoypadEffectsCallback, (void*)this, DIDFT_FFACTUATOR);
jp.hid.rumble = effects > 0;
DIPROPGUIDANDPATH property;
memset(&property, 0, sizeof(DIPROPGUIDANDPATH));
property.diph.dwSize = sizeof(DIPROPGUIDANDPATH);
property.diph.dwHeaderSize = sizeof(DIPROPHEADER);
property.diph.dwObj = 0;
property.diph.dwHow = DIPH_DEVICE;
device->GetProperty(DIPROP_GUIDANDPATH, &property.diph);
string devicePath = (const char*)utf8_t(property.wszPath);
jp.pathID = crc32_calculate((const uint8_t*)devicePath.data(), devicePath.size());
jp.hid.id = (uint64_t)jp.pathID << 32 | jp.vendorID << 16 | jp.productID << 0;
if(jp.hid.rumble) {
//disable auto-centering spring for rumble support
DIPROPDWORD property;

View File

@@ -15,13 +15,12 @@ namespace ruby {
namespace ruby {
struct pVideoCGL : OpenGL {
RubyVideoCGL* view;
RubyVideoCGL* view = nullptr;
struct {
NSView* handle;
bool synchronize;
unsigned filter;
NSView* handle = nullptr;
bool synchronize = false;
unsigned filter = 0;
string shader;
} settings;
@@ -157,14 +156,6 @@ struct pVideoCGL : OpenGL {
}
}
pVideoCGL() {
view = nil;
settings.handle = nil;
settings.synchronize = false;
settings.filter = 0;
}
~pVideoCGL() {
term();
}

View File

@@ -200,11 +200,13 @@ bool OpenGL::init() {
glrLinkProgram(program);
shader(nullptr);
return true;
return initialized = true;
}
void OpenGL::term() {
if(initialized == false) return;
shader(nullptr); //release shader resources (eg frame[] history)
OpenGLSurface::release();
if(buffer) { delete[] buffer; buffer = nullptr; }
initialized = false;
}

View File

@@ -79,6 +79,7 @@ struct OpenGL : OpenGLProgram {
Setting(const string& name, const string& value) : name(name), value(value) {}
};
set<Setting> settings;
bool initialized = false;
void shader(const char* pathname);
void allocateHistory(unsigned size);