Reformat all the things. Have fun with merge conflicts.

This commit is contained in:
Pierre Bourdon 2016-06-24 10:43:46 +02:00
parent 2115e8a4a6
commit 3570c7f03a
1116 changed files with 187405 additions and 180344 deletions

View File

@ -11,313 +11,93 @@
namespace ButtonManager namespace ButtonManager
{ {
const std::string touchScreenKey = "Touchscreen"; const std::string touchScreenKey = "Touchscreen";
std::unordered_map<std::string, InputDevice*> m_controllers; std::unordered_map<std::string, InputDevice*> m_controllers;
std::vector<std::string> configStrings = { std::vector<std::string> configStrings = {
// GC // GC
"InputA", "InputA", "InputB", "InputStart", "InputX", "InputY", "InputZ", "DPadUp", "DPadDown",
"InputB", "DPadLeft", "DPadRight", "MainUp", "MainDown", "MainLeft", "MainRight", "CStickUp",
"InputStart", "CStickDown", "CStickLeft", "CStickRight", "InputL", "InputR",
"InputX",
"InputY",
"InputZ",
"DPadUp",
"DPadDown",
"DPadLeft",
"DPadRight",
"MainUp",
"MainDown",
"MainLeft",
"MainRight",
"CStickUp",
"CStickDown",
"CStickLeft",
"CStickRight",
"InputL",
"InputR",
// Wiimote // Wiimote
"WiimoteA", "WiimoteA", "WiimoteB", "WiimoteMinus", "WiimotePlus", "WiimoteHome", "Wiimote1", "Wiimote2",
"WiimoteB", "WiimoteUp", "WiimoteDown", "WiimoteLeft", "WiimoteRight", "IRUp", "IRDown", "IRLeft",
"WiimoteMinus", "IRRight", "IRForward", "IRBackward", "IRHide", "SwingUp", "SwingDown", "SwingLeft",
"WiimotePlus", "SwingRight", "SwingForward", "SwingBackward", "TiltForward", "TiltBackward", "TiltLeft",
"WiimoteHome", "TiltRight", "TiltModifier"
"Wiimote1",
"Wiimote2",
"WiimoteUp",
"WiimoteDown",
"WiimoteLeft",
"WiimoteRight",
"IRUp",
"IRDown",
"IRLeft",
"IRRight",
"IRForward",
"IRBackward",
"IRHide",
"SwingUp",
"SwingDown",
"SwingLeft",
"SwingRight",
"SwingForward",
"SwingBackward",
"TiltForward",
"TiltBackward",
"TiltLeft",
"TiltRight",
"TiltModifier"
"ShakeX", "ShakeX",
"ShakeY", "ShakeY", "ShakeZ",
"ShakeZ",
// Nunchuk // Nunchuk
"NunchukC", "NunchukC", "NunchukZ", "NunchukUp", "NunchukDown", "NunchukLeft", "NunchukRight",
"NunchukZ", "NunchukSwingUp", "NunchukSwingDown", "NunchukSwingLeft", "NunchukSwingRight",
"NunchukUp", "NunchukSwingForward", "NunchukSwingBackward", "NunchukTiltForward", "NunchukTiltBackward",
"NunchukDown", "NunchukTiltLeft", "NunchukTiltRight", "NunchukTiltModifier", "NunchukShakeX", "NunchukShakeY",
"NunchukLeft",
"NunchukRight",
"NunchukSwingUp",
"NunchukSwingDown",
"NunchukSwingLeft",
"NunchukSwingRight",
"NunchukSwingForward",
"NunchukSwingBackward",
"NunchukTiltForward",
"NunchukTiltBackward",
"NunchukTiltLeft",
"NunchukTiltRight",
"NunchukTiltModifier",
"NunchukShakeX",
"NunchukShakeY",
"NunchukShakeZ", "NunchukShakeZ",
// Classic // Classic
"ClassicA", "ClassicA", "ClassicB", "ClassicX", "ClassicY", "ClassicMinus", "ClassicPlus", "ClassicHome",
"ClassicB", "ClassicZL", "ClassicZR", "ClassicUp", "ClassicDown", "ClassicLeft", "ClassicRight",
"ClassicX", "ClassicLeftStickUp", "ClassicLeftStickDown", "ClassicLeftStickLeft", "ClassicLeftStickRight",
"ClassicY", "ClassicRightStickUp", "ClassicRightStickDown", "ClassicRightStickLeft",
"ClassicMinus", "ClassicRightStickRight", "ClassicTriggerL", "ClassicTriggerR",
"ClassicPlus",
"ClassicHome",
"ClassicZL",
"ClassicZR",
"ClassicUp",
"ClassicDown",
"ClassicLeft",
"ClassicRight",
"ClassicLeftStickUp",
"ClassicLeftStickDown",
"ClassicLeftStickLeft",
"ClassicLeftStickRight",
"ClassicRightStickUp",
"ClassicRightStickDown",
"ClassicRightStickLeft",
"ClassicRightStickRight",
"ClassicTriggerL",
"ClassicTriggerR",
// Guitar // Guitar
"GuitarMinus", "GuitarMinus", "GuitarPlus", "GuitarGreen", "GuitarRed", "GuitarYellow", "GuitarBue",
"GuitarPlus", "GuitarOrange", "GuitarStrumUp", "GuitarStrumDown", "GuitarUp", "GuitarDown", "GuitarLeft",
"GuitarGreen", "GuitarRight", "GuitarWhammy",
"GuitarRed",
"GuitarYellow",
"GuitarBue",
"GuitarOrange",
"GuitarStrumUp",
"GuitarStrumDown",
"GuitarUp",
"GuitarDown",
"GuitarLeft",
"GuitarRight",
"GuitarWhammy",
// Drums // Drums
"DrumsMinus", "DrumsMinus", "DrumsPlus", "DrumsRed", "DrumsYellow", "DrumsBlue", "DrumsGreen", "DrumsOrange",
"DrumsPlus", "DrumsBass", "DrumsUp", "DrumsDown", "DrumsLeft", "DrumsRight",
"DrumsRed",
"DrumsYellow",
"DrumsBlue",
"DrumsGreen",
"DrumsOrange",
"DrumsBass",
"DrumsUp",
"DrumsDown",
"DrumsLeft",
"DrumsRight",
// Turntable // Turntable
"TurntableGreenLeft", "TurntableGreenLeft", "TurntableRedLeft", "TurntableBlueLeft", "TurntableGreenRight",
"TurntableRedLeft", "TurntableRedRight", "TurntableBlueRight", "TurntableMinus", "TurntablePlus", "TurntableHome",
"TurntableBlueLeft", "TurntableEuphoria", "TurntableLeftTLeft", "TurntableLeftTRight", "TurntableRightTLeft",
"TurntableGreenRight", "TurntableRightTRight", "TurntableUp", "TurntableDown", "TurntableLeft", "TurntableRight",
"TurntableRedRight", "TurntableEffDial", "TurntableCrossLeft", "TurntableCrossRight",
"TurntableBlueRight", };
"TurntableMinus", std::vector<ButtonType> configTypes = {
"TurntablePlus",
"TurntableHome",
"TurntableEuphoria",
"TurntableLeftTLeft",
"TurntableLeftTRight",
"TurntableRightTLeft",
"TurntableRightTRight",
"TurntableUp",
"TurntableDown",
"TurntableLeft",
"TurntableRight",
"TurntableEffDial",
"TurntableCrossLeft",
"TurntableCrossRight",
};
std::vector<ButtonType> configTypes = {
// GC // GC
BUTTON_A, BUTTON_A, BUTTON_B, BUTTON_START, BUTTON_X, BUTTON_Y, BUTTON_Z, BUTTON_UP, BUTTON_DOWN,
BUTTON_B, BUTTON_LEFT, BUTTON_RIGHT, STICK_MAIN_UP, STICK_MAIN_DOWN, STICK_MAIN_LEFT, STICK_MAIN_RIGHT,
BUTTON_START, STICK_C_UP, STICK_C_DOWN, STICK_C_LEFT, STICK_C_RIGHT, TRIGGER_L, TRIGGER_R,
BUTTON_X,
BUTTON_Y,
BUTTON_Z,
BUTTON_UP,
BUTTON_DOWN,
BUTTON_LEFT,
BUTTON_RIGHT,
STICK_MAIN_UP,
STICK_MAIN_DOWN,
STICK_MAIN_LEFT,
STICK_MAIN_RIGHT,
STICK_C_UP,
STICK_C_DOWN,
STICK_C_LEFT,
STICK_C_RIGHT,
TRIGGER_L,
TRIGGER_R,
// Wiimote // Wiimote
WIIMOTE_BUTTON_A, WIIMOTE_BUTTON_A, WIIMOTE_BUTTON_B, WIIMOTE_BUTTON_MINUS, WIIMOTE_BUTTON_PLUS,
WIIMOTE_BUTTON_B, WIIMOTE_BUTTON_HOME, WIIMOTE_BUTTON_1, WIIMOTE_BUTTON_2, WIIMOTE_UP, WIIMOTE_DOWN, WIIMOTE_LEFT,
WIIMOTE_BUTTON_MINUS, WIIMOTE_RIGHT, WIIMOTE_IR_UP, WIIMOTE_IR_DOWN, WIIMOTE_IR_LEFT, WIIMOTE_IR_RIGHT,
WIIMOTE_BUTTON_PLUS, WIIMOTE_IR_FORWARD, WIIMOTE_IR_BACKWARD, WIIMOTE_IR_HIDE, WIIMOTE_SWING_UP, WIIMOTE_SWING_DOWN,
WIIMOTE_BUTTON_HOME, WIIMOTE_SWING_LEFT, WIIMOTE_SWING_RIGHT, WIIMOTE_SWING_FORWARD, WIIMOTE_SWING_BACKWARD,
WIIMOTE_BUTTON_1, WIIMOTE_TILT_FORWARD, WIIMOTE_TILT_BACKWARD, WIIMOTE_TILT_LEFT, WIIMOTE_TILT_RIGHT,
WIIMOTE_BUTTON_2, WIIMOTE_TILT_MODIFIER, WIIMOTE_SHAKE_X, WIIMOTE_SHAKE_Y, WIIMOTE_SHAKE_Z,
WIIMOTE_UP,
WIIMOTE_DOWN,
WIIMOTE_LEFT,
WIIMOTE_RIGHT,
WIIMOTE_IR_UP,
WIIMOTE_IR_DOWN,
WIIMOTE_IR_LEFT,
WIIMOTE_IR_RIGHT,
WIIMOTE_IR_FORWARD,
WIIMOTE_IR_BACKWARD,
WIIMOTE_IR_HIDE,
WIIMOTE_SWING_UP,
WIIMOTE_SWING_DOWN,
WIIMOTE_SWING_LEFT,
WIIMOTE_SWING_RIGHT,
WIIMOTE_SWING_FORWARD,
WIIMOTE_SWING_BACKWARD,
WIIMOTE_TILT_FORWARD,
WIIMOTE_TILT_BACKWARD,
WIIMOTE_TILT_LEFT,
WIIMOTE_TILT_RIGHT,
WIIMOTE_TILT_MODIFIER,
WIIMOTE_SHAKE_X,
WIIMOTE_SHAKE_Y,
WIIMOTE_SHAKE_Z,
// Nunchuk // Nunchuk
NUNCHUK_BUTTON_C, NUNCHUK_BUTTON_C, NUNCHUK_BUTTON_Z, NUNCHUK_STICK_UP, NUNCHUK_STICK_DOWN, NUNCHUK_STICK_LEFT,
NUNCHUK_BUTTON_Z, NUNCHUK_STICK_RIGHT, NUNCHUK_SWING_UP, NUNCHUK_SWING_DOWN, NUNCHUK_SWING_LEFT,
NUNCHUK_STICK_UP, NUNCHUK_SWING_RIGHT, NUNCHUK_SWING_FORWARD, NUNCHUK_SWING_BACKWARD, NUNCHUK_TILT_FORWARD,
NUNCHUK_STICK_DOWN, NUNCHUK_TILT_BACKWARD, NUNCHUK_TILT_LEFT, NUNCHUK_TILT_RIGHT, NUNCHUK_TILT_MODIFIER,
NUNCHUK_STICK_LEFT, NUNCHUK_SHAKE_X, NUNCHUK_SHAKE_Y, NUNCHUK_SHAKE_Z,
NUNCHUK_STICK_RIGHT,
NUNCHUK_SWING_UP,
NUNCHUK_SWING_DOWN,
NUNCHUK_SWING_LEFT,
NUNCHUK_SWING_RIGHT,
NUNCHUK_SWING_FORWARD,
NUNCHUK_SWING_BACKWARD,
NUNCHUK_TILT_FORWARD,
NUNCHUK_TILT_BACKWARD,
NUNCHUK_TILT_LEFT,
NUNCHUK_TILT_RIGHT,
NUNCHUK_TILT_MODIFIER,
NUNCHUK_SHAKE_X,
NUNCHUK_SHAKE_Y,
NUNCHUK_SHAKE_Z,
// Classic // Classic
CLASSIC_BUTTON_A, CLASSIC_BUTTON_A, CLASSIC_BUTTON_B, CLASSIC_BUTTON_X, CLASSIC_BUTTON_Y, CLASSIC_BUTTON_MINUS,
CLASSIC_BUTTON_B, CLASSIC_BUTTON_PLUS, CLASSIC_BUTTON_HOME, CLASSIC_BUTTON_ZL, CLASSIC_BUTTON_ZR, CLASSIC_DPAD_UP,
CLASSIC_BUTTON_X, CLASSIC_DPAD_DOWN, CLASSIC_DPAD_LEFT, CLASSIC_DPAD_RIGHT, CLASSIC_STICK_LEFT_UP,
CLASSIC_BUTTON_Y, CLASSIC_STICK_LEFT_DOWN, CLASSIC_STICK_LEFT_LEFT, CLASSIC_STICK_LEFT_RIGHT,
CLASSIC_BUTTON_MINUS, CLASSIC_STICK_RIGHT_UP, CLASSIC_STICK_RIGHT_DOWN, CLASSIC_STICK_RIGHT_LEFT,
CLASSIC_BUTTON_PLUS, CLASSIC_STICK_RIGHT_RIGHT, CLASSIC_TRIGGER_L, CLASSIC_TRIGGER_R,
CLASSIC_BUTTON_HOME,
CLASSIC_BUTTON_ZL,
CLASSIC_BUTTON_ZR,
CLASSIC_DPAD_UP,
CLASSIC_DPAD_DOWN,
CLASSIC_DPAD_LEFT,
CLASSIC_DPAD_RIGHT,
CLASSIC_STICK_LEFT_UP,
CLASSIC_STICK_LEFT_DOWN,
CLASSIC_STICK_LEFT_LEFT,
CLASSIC_STICK_LEFT_RIGHT,
CLASSIC_STICK_RIGHT_UP,
CLASSIC_STICK_RIGHT_DOWN,
CLASSIC_STICK_RIGHT_LEFT,
CLASSIC_STICK_RIGHT_RIGHT,
CLASSIC_TRIGGER_L,
CLASSIC_TRIGGER_R,
// Guitar // Guitar
GUITAR_BUTTON_MINUS, GUITAR_BUTTON_MINUS, GUITAR_BUTTON_PLUS, GUITAR_FRET_GREEN, GUITAR_FRET_RED, GUITAR_FRET_YELLOW,
GUITAR_BUTTON_PLUS, GUITAR_FRET_BLUE, GUITAR_FRET_ORANGE, GUITAR_STRUM_UP, GUITAR_STRUM_DOWN, GUITAR_STICK_UP,
GUITAR_FRET_GREEN, GUITAR_STICK_DOWN, GUITAR_STICK_LEFT, GUITAR_STICK_RIGHT, GUITAR_WHAMMY_BAR,
GUITAR_FRET_RED,
GUITAR_FRET_YELLOW,
GUITAR_FRET_BLUE,
GUITAR_FRET_ORANGE,
GUITAR_STRUM_UP,
GUITAR_STRUM_DOWN,
GUITAR_STICK_UP,
GUITAR_STICK_DOWN,
GUITAR_STICK_LEFT,
GUITAR_STICK_RIGHT,
GUITAR_WHAMMY_BAR,
// Drums // Drums
DRUMS_BUTTON_MINUS, DRUMS_BUTTON_MINUS, DRUMS_BUTTON_PLUS, DRUMS_PAD_RED, DRUMS_PAD_YELLOW, DRUMS_PAD_BLUE,
DRUMS_BUTTON_PLUS, DRUMS_PAD_GREEN, DRUMS_PAD_ORANGE, DRUMS_PAD_BASS, DRUMS_STICK_UP, DRUMS_STICK_DOWN,
DRUMS_PAD_RED, DRUMS_STICK_LEFT, DRUMS_STICK_RIGHT,
DRUMS_PAD_YELLOW,
DRUMS_PAD_BLUE,
DRUMS_PAD_GREEN,
DRUMS_PAD_ORANGE,
DRUMS_PAD_BASS,
DRUMS_STICK_UP,
DRUMS_STICK_DOWN,
DRUMS_STICK_LEFT,
DRUMS_STICK_RIGHT,
// Turntable // Turntable
TURNTABLE_BUTTON_GREEN_LEFT, TURNTABLE_BUTTON_GREEN_LEFT, TURNTABLE_BUTTON_RED_LEFT, TURNTABLE_BUTTON_BLUE_LEFT,
TURNTABLE_BUTTON_RED_LEFT, TURNTABLE_BUTTON_GREEN_RIGHT, TURNTABLE_BUTTON_RED_RIGHT, TURNTABLE_BUTTON_BLUE_RIGHT,
TURNTABLE_BUTTON_BLUE_LEFT, TURNTABLE_BUTTON_MINUS, TURNTABLE_BUTTON_PLUS, TURNTABLE_BUTTON_HOME, TURNTABLE_BUTTON_EUPHORIA,
TURNTABLE_BUTTON_GREEN_RIGHT, TURNTABLE_TABLE_LEFT_LEFT, TURNTABLE_TABLE_LEFT_RIGHT, TURNTABLE_TABLE_RIGHT_LEFT,
TURNTABLE_BUTTON_RED_RIGHT, TURNTABLE_TABLE_RIGHT_RIGHT, TURNTABLE_STICK_UP, TURNTABLE_STICK_DOWN, TURNTABLE_STICK_LEFT,
TURNTABLE_BUTTON_BLUE_RIGHT, TURNTABLE_STICK_RIGHT, TURNTABLE_EFFECT_DIAL, TURNTABLE_CROSSFADE_LEFT,
TURNTABLE_BUTTON_MINUS,
TURNTABLE_BUTTON_PLUS,
TURNTABLE_BUTTON_HOME,
TURNTABLE_BUTTON_EUPHORIA,
TURNTABLE_TABLE_LEFT_LEFT,
TURNTABLE_TABLE_LEFT_RIGHT,
TURNTABLE_TABLE_RIGHT_LEFT,
TURNTABLE_TABLE_RIGHT_RIGHT,
TURNTABLE_STICK_UP,
TURNTABLE_STICK_DOWN,
TURNTABLE_STICK_LEFT,
TURNTABLE_STICK_RIGHT,
TURNTABLE_EFFECT_DIAL,
TURNTABLE_CROSSFADE_LEFT,
TURNTABLE_CROSSFADE_RIGHT, TURNTABLE_CROSSFADE_RIGHT,
}; };
static void AddBind(const std::string& dev, sBind *bind) static void AddBind(const std::string& dev, sBind* bind)
{ {
auto it = m_controllers.find(dev); auto it = m_controllers.find(dev);
if (it != m_controllers.end()) if (it != m_controllers.end())
{ {
@ -326,10 +106,10 @@ namespace ButtonManager
} }
m_controllers[dev] = new InputDevice(dev); m_controllers[dev] = new InputDevice(dev);
m_controllers[dev]->AddBind(bind); m_controllers[dev]->AddBind(bind);
} }
void Init() void Init()
{ {
// Initialize our touchScreenKey buttons // Initialize our touchScreenKey buttons
for (int a = 0; a < 8; ++a) for (int a = 0; a < 8; ++a)
{ {
@ -359,9 +139,12 @@ namespace ButtonManager
// Wiimote // Wiimote
AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_A, BIND_BUTTON, WIIMOTE_BUTTON_A, 1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_A, BIND_BUTTON, WIIMOTE_BUTTON_A, 1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_B, BIND_BUTTON, WIIMOTE_BUTTON_B, 1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_B, BIND_BUTTON, WIIMOTE_BUTTON_B, 1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_MINUS, BIND_BUTTON, WIIMOTE_BUTTON_MINUS, 1.0f)); AddBind(touchScreenKey,
AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_PLUS, BIND_BUTTON, WIIMOTE_BUTTON_PLUS, 1.0f)); new sBind(a, WIIMOTE_BUTTON_MINUS, BIND_BUTTON, WIIMOTE_BUTTON_MINUS, 1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_HOME, BIND_BUTTON, WIIMOTE_BUTTON_HOME, 1.0f)); AddBind(touchScreenKey,
new sBind(a, WIIMOTE_BUTTON_PLUS, BIND_BUTTON, WIIMOTE_BUTTON_PLUS, 1.0f));
AddBind(touchScreenKey,
new sBind(a, WIIMOTE_BUTTON_HOME, BIND_BUTTON, WIIMOTE_BUTTON_HOME, 1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_1, BIND_BUTTON, WIIMOTE_BUTTON_1, 1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_1, BIND_BUTTON, WIIMOTE_BUTTON_1, 1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_2, BIND_BUTTON, WIIMOTE_BUTTON_2, 1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_BUTTON_2, BIND_BUTTON, WIIMOTE_BUTTON_2, 1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_UP, BIND_BUTTON, WIIMOTE_UP, 1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_UP, BIND_BUTTON, WIIMOTE_UP, 1.0f));
@ -369,7 +152,8 @@ namespace ButtonManager
AddBind(touchScreenKey, new sBind(a, WIIMOTE_LEFT, BIND_BUTTON, WIIMOTE_LEFT, 1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_LEFT, BIND_BUTTON, WIIMOTE_LEFT, 1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_RIGHT, BIND_BUTTON, WIIMOTE_RIGHT, 1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_RIGHT, BIND_BUTTON, WIIMOTE_RIGHT, 1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_IR_HIDE, BIND_BUTTON, WIIMOTE_IR_HIDE, 1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_IR_HIDE, BIND_BUTTON, WIIMOTE_IR_HIDE, 1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_TILT_MODIFIER, BIND_BUTTON, WIIMOTE_TILT_MODIFIER, 1.0f)); AddBind(touchScreenKey,
new sBind(a, WIIMOTE_TILT_MODIFIER, BIND_BUTTON, WIIMOTE_TILT_MODIFIER, 1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_SHAKE_X, BIND_BUTTON, WIIMOTE_SHAKE_X, 1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_SHAKE_X, BIND_BUTTON, WIIMOTE_SHAKE_X, 1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_SHAKE_Y, BIND_BUTTON, WIIMOTE_SHAKE_Y, 1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_SHAKE_Y, BIND_BUTTON, WIIMOTE_SHAKE_Y, 1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_SHAKE_Z, BIND_BUTTON, WIIMOTE_SHAKE_Z, 1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_SHAKE_Z, BIND_BUTTON, WIIMOTE_SHAKE_Z, 1.0f));
@ -379,22 +163,29 @@ namespace ButtonManager
AddBind(touchScreenKey, new sBind(a, WIIMOTE_IR_LEFT, BIND_AXIS, WIIMOTE_IR_LEFT, -1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_IR_LEFT, BIND_AXIS, WIIMOTE_IR_LEFT, -1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_IR_RIGHT, BIND_AXIS, WIIMOTE_IR_RIGHT, 1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_IR_RIGHT, BIND_AXIS, WIIMOTE_IR_RIGHT, 1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_IR_FORWARD, BIND_AXIS, WIIMOTE_IR_FORWARD, -1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_IR_FORWARD, BIND_AXIS, WIIMOTE_IR_FORWARD, -1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_IR_BACKWARD, BIND_AXIS, WIIMOTE_IR_BACKWARD, 1.0f)); AddBind(touchScreenKey,
new sBind(a, WIIMOTE_IR_BACKWARD, BIND_AXIS, WIIMOTE_IR_BACKWARD, 1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_SWING_UP, BIND_AXIS, WIIMOTE_SWING_UP, -1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_SWING_UP, BIND_AXIS, WIIMOTE_SWING_UP, -1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_SWING_DOWN, BIND_AXIS, WIIMOTE_SWING_DOWN, 1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_SWING_DOWN, BIND_AXIS, WIIMOTE_SWING_DOWN, 1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_SWING_LEFT, BIND_AXIS, WIIMOTE_SWING_LEFT, -1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_SWING_LEFT, BIND_AXIS, WIIMOTE_SWING_LEFT, -1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_SWING_RIGHT, BIND_AXIS, WIIMOTE_SWING_RIGHT, 1.0f)); AddBind(touchScreenKey,
AddBind(touchScreenKey, new sBind(a, WIIMOTE_SWING_FORWARD, BIND_AXIS, WIIMOTE_SWING_FORWARD, -1.0f)); new sBind(a, WIIMOTE_SWING_RIGHT, BIND_AXIS, WIIMOTE_SWING_RIGHT, 1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_SWING_BACKWARD, BIND_AXIS, WIIMOTE_SWING_BACKWARD, 1.0f)); AddBind(touchScreenKey,
AddBind(touchScreenKey, new sBind(a, WIIMOTE_TILT_FORWARD, BIND_AXIS, WIIMOTE_TILT_FORWARD, -1.0f)); new sBind(a, WIIMOTE_SWING_FORWARD, BIND_AXIS, WIIMOTE_SWING_FORWARD, -1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_TILT_BACKWARD, BIND_AXIS, WIIMOTE_TILT_BACKWARD, 1.0f)); AddBind(touchScreenKey,
new sBind(a, WIIMOTE_SWING_BACKWARD, BIND_AXIS, WIIMOTE_SWING_BACKWARD, 1.0f));
AddBind(touchScreenKey,
new sBind(a, WIIMOTE_TILT_FORWARD, BIND_AXIS, WIIMOTE_TILT_FORWARD, -1.0f));
AddBind(touchScreenKey,
new sBind(a, WIIMOTE_TILT_BACKWARD, BIND_AXIS, WIIMOTE_TILT_BACKWARD, 1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_TILT_LEFT, BIND_AXIS, WIIMOTE_TILT_LEFT, -1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_TILT_LEFT, BIND_AXIS, WIIMOTE_TILT_LEFT, -1.0f));
AddBind(touchScreenKey, new sBind(a, WIIMOTE_TILT_RIGHT, BIND_AXIS, WIIMOTE_TILT_RIGHT, 1.0f)); AddBind(touchScreenKey, new sBind(a, WIIMOTE_TILT_RIGHT, BIND_AXIS, WIIMOTE_TILT_RIGHT, 1.0f));
// Wii: Nunchuk // Wii: Nunchuk
AddBind(touchScreenKey, new sBind(a, NUNCHUK_BUTTON_C, BIND_BUTTON, NUNCHUK_BUTTON_C, 1.0f)); AddBind(touchScreenKey, new sBind(a, NUNCHUK_BUTTON_C, BIND_BUTTON, NUNCHUK_BUTTON_C, 1.0f));
AddBind(touchScreenKey, new sBind(a, NUNCHUK_BUTTON_Z, BIND_BUTTON, NUNCHUK_BUTTON_Z, 1.0f)); AddBind(touchScreenKey, new sBind(a, NUNCHUK_BUTTON_Z, BIND_BUTTON, NUNCHUK_BUTTON_Z, 1.0f));
AddBind(touchScreenKey, new sBind(a, NUNCHUK_TILT_MODIFIER, BIND_BUTTON, NUNCHUK_TILT_MODIFIER, 1.0f)); AddBind(touchScreenKey,
new sBind(a, NUNCHUK_TILT_MODIFIER, BIND_BUTTON, NUNCHUK_TILT_MODIFIER, 1.0f));
AddBind(touchScreenKey, new sBind(a, NUNCHUK_SHAKE_X, BIND_BUTTON, NUNCHUK_SHAKE_X, 1.0f)); AddBind(touchScreenKey, new sBind(a, NUNCHUK_SHAKE_X, BIND_BUTTON, NUNCHUK_SHAKE_X, 1.0f));
AddBind(touchScreenKey, new sBind(a, NUNCHUK_SHAKE_Y, BIND_BUTTON, NUNCHUK_SHAKE_Y, 1.0f)); AddBind(touchScreenKey, new sBind(a, NUNCHUK_SHAKE_Y, BIND_BUTTON, NUNCHUK_SHAKE_Y, 1.0f));
AddBind(touchScreenKey, new sBind(a, NUNCHUK_SHAKE_Z, BIND_BUTTON, NUNCHUK_SHAKE_Z, 1.0f)); AddBind(touchScreenKey, new sBind(a, NUNCHUK_SHAKE_Z, BIND_BUTTON, NUNCHUK_SHAKE_Z, 1.0f));
@ -402,52 +193,74 @@ namespace ButtonManager
AddBind(touchScreenKey, new sBind(a, NUNCHUK_SWING_UP, BIND_AXIS, NUNCHUK_SWING_UP, -1.0f)); AddBind(touchScreenKey, new sBind(a, NUNCHUK_SWING_UP, BIND_AXIS, NUNCHUK_SWING_UP, -1.0f));
AddBind(touchScreenKey, new sBind(a, NUNCHUK_SWING_DOWN, BIND_AXIS, NUNCHUK_SWING_DOWN, 1.0f)); AddBind(touchScreenKey, new sBind(a, NUNCHUK_SWING_DOWN, BIND_AXIS, NUNCHUK_SWING_DOWN, 1.0f));
AddBind(touchScreenKey, new sBind(a, NUNCHUK_SWING_LEFT, BIND_AXIS, NUNCHUK_SWING_LEFT, -1.0f)); AddBind(touchScreenKey, new sBind(a, NUNCHUK_SWING_LEFT, BIND_AXIS, NUNCHUK_SWING_LEFT, -1.0f));
AddBind(touchScreenKey, new sBind(a, NUNCHUK_SWING_RIGHT, BIND_AXIS, NUNCHUK_SWING_RIGHT, 1.0f)); AddBind(touchScreenKey,
AddBind(touchScreenKey, new sBind(a, NUNCHUK_SWING_FORWARD, BIND_AXIS, NUNCHUK_SWING_FORWARD, -1.0f)); new sBind(a, NUNCHUK_SWING_RIGHT, BIND_AXIS, NUNCHUK_SWING_RIGHT, 1.0f));
AddBind(touchScreenKey, new sBind(a, NUNCHUK_SWING_BACKWARD, BIND_BUTTON, NUNCHUK_SWING_BACKWARD, 1.0f)); AddBind(touchScreenKey,
AddBind(touchScreenKey, new sBind(a, NUNCHUK_TILT_FORWARD, BIND_AXIS, NUNCHUK_TILT_FORWARD, -1.0f)); new sBind(a, NUNCHUK_SWING_FORWARD, BIND_AXIS, NUNCHUK_SWING_FORWARD, -1.0f));
AddBind(touchScreenKey, new sBind(a, NUNCHUK_TILT_BACKWARD, BIND_AXIS, NUNCHUK_TILT_BACKWARD, 1.0f)); AddBind(touchScreenKey,
new sBind(a, NUNCHUK_SWING_BACKWARD, BIND_BUTTON, NUNCHUK_SWING_BACKWARD, 1.0f));
AddBind(touchScreenKey,
new sBind(a, NUNCHUK_TILT_FORWARD, BIND_AXIS, NUNCHUK_TILT_FORWARD, -1.0f));
AddBind(touchScreenKey,
new sBind(a, NUNCHUK_TILT_BACKWARD, BIND_AXIS, NUNCHUK_TILT_BACKWARD, 1.0f));
AddBind(touchScreenKey, new sBind(a, NUNCHUK_TILT_LEFT, BIND_AXIS, NUNCHUK_TILT_LEFT, -1.0f)); AddBind(touchScreenKey, new sBind(a, NUNCHUK_TILT_LEFT, BIND_AXIS, NUNCHUK_TILT_LEFT, -1.0f));
AddBind(touchScreenKey, new sBind(a, NUNCHUK_TILT_RIGHT, BIND_AXIS, NUNCHUK_TILT_RIGHT, 1.0f)); AddBind(touchScreenKey, new sBind(a, NUNCHUK_TILT_RIGHT, BIND_AXIS, NUNCHUK_TILT_RIGHT, 1.0f));
AddBind(touchScreenKey, new sBind(a, NUNCHUK_STICK_UP, BIND_AXIS, NUNCHUK_STICK_UP, -1.0f)); AddBind(touchScreenKey, new sBind(a, NUNCHUK_STICK_UP, BIND_AXIS, NUNCHUK_STICK_UP, -1.0f));
AddBind(touchScreenKey, new sBind(a, NUNCHUK_STICK_DOWN, BIND_AXIS, NUNCHUK_STICK_DOWN, 1.0f)); AddBind(touchScreenKey, new sBind(a, NUNCHUK_STICK_DOWN, BIND_AXIS, NUNCHUK_STICK_DOWN, 1.0f));
AddBind(touchScreenKey, new sBind(a, NUNCHUK_STICK_LEFT, BIND_AXIS, NUNCHUK_STICK_LEFT, -1.0f)); AddBind(touchScreenKey, new sBind(a, NUNCHUK_STICK_LEFT, BIND_AXIS, NUNCHUK_STICK_LEFT, -1.0f));
AddBind(touchScreenKey, new sBind(a, NUNCHUK_STICK_RIGHT, BIND_AXIS, NUNCHUK_STICK_RIGHT, 1.0f)); AddBind(touchScreenKey,
new sBind(a, NUNCHUK_STICK_RIGHT, BIND_AXIS, NUNCHUK_STICK_RIGHT, 1.0f));
// Wii: Classic // Wii: Classic
AddBind(touchScreenKey, new sBind(a, CLASSIC_BUTTON_A, BIND_BUTTON, CLASSIC_BUTTON_A, 1.0f)); AddBind(touchScreenKey, new sBind(a, CLASSIC_BUTTON_A, BIND_BUTTON, CLASSIC_BUTTON_A, 1.0f));
AddBind(touchScreenKey, new sBind(a, CLASSIC_BUTTON_B, BIND_BUTTON, CLASSIC_BUTTON_B, 1.0f)); AddBind(touchScreenKey, new sBind(a, CLASSIC_BUTTON_B, BIND_BUTTON, CLASSIC_BUTTON_B, 1.0f));
AddBind(touchScreenKey, new sBind(a, CLASSIC_BUTTON_X, BIND_BUTTON, CLASSIC_BUTTON_X, 1.0f)); AddBind(touchScreenKey, new sBind(a, CLASSIC_BUTTON_X, BIND_BUTTON, CLASSIC_BUTTON_X, 1.0f));
AddBind(touchScreenKey, new sBind(a, CLASSIC_BUTTON_Y, BIND_BUTTON, CLASSIC_BUTTON_Y, 1.0f)); AddBind(touchScreenKey, new sBind(a, CLASSIC_BUTTON_Y, BIND_BUTTON, CLASSIC_BUTTON_Y, 1.0f));
AddBind(touchScreenKey, new sBind(a, CLASSIC_BUTTON_MINUS, BIND_BUTTON, CLASSIC_BUTTON_MINUS, 1.0f)); AddBind(touchScreenKey,
AddBind(touchScreenKey, new sBind(a, CLASSIC_BUTTON_PLUS, BIND_BUTTON, CLASSIC_BUTTON_PLUS, 1.0f)); new sBind(a, CLASSIC_BUTTON_MINUS, BIND_BUTTON, CLASSIC_BUTTON_MINUS, 1.0f));
AddBind(touchScreenKey, new sBind(a, CLASSIC_BUTTON_HOME, BIND_BUTTON, CLASSIC_BUTTON_HOME, 1.0f)); AddBind(touchScreenKey,
new sBind(a, CLASSIC_BUTTON_PLUS, BIND_BUTTON, CLASSIC_BUTTON_PLUS, 1.0f));
AddBind(touchScreenKey,
new sBind(a, CLASSIC_BUTTON_HOME, BIND_BUTTON, CLASSIC_BUTTON_HOME, 1.0f));
AddBind(touchScreenKey, new sBind(a, CLASSIC_BUTTON_ZL, BIND_BUTTON, CLASSIC_BUTTON_ZL, 1.0f)); AddBind(touchScreenKey, new sBind(a, CLASSIC_BUTTON_ZL, BIND_BUTTON, CLASSIC_BUTTON_ZL, 1.0f));
AddBind(touchScreenKey, new sBind(a, CLASSIC_BUTTON_ZR, BIND_BUTTON, CLASSIC_BUTTON_ZR, 1.0f)); AddBind(touchScreenKey, new sBind(a, CLASSIC_BUTTON_ZR, BIND_BUTTON, CLASSIC_BUTTON_ZR, 1.0f));
AddBind(touchScreenKey, new sBind(a, CLASSIC_DPAD_UP, BIND_BUTTON, CLASSIC_DPAD_UP, 1.0f)); AddBind(touchScreenKey, new sBind(a, CLASSIC_DPAD_UP, BIND_BUTTON, CLASSIC_DPAD_UP, 1.0f));
AddBind(touchScreenKey, new sBind(a, CLASSIC_DPAD_DOWN, BIND_BUTTON, CLASSIC_DPAD_DOWN, 1.0f)); AddBind(touchScreenKey, new sBind(a, CLASSIC_DPAD_DOWN, BIND_BUTTON, CLASSIC_DPAD_DOWN, 1.0f));
AddBind(touchScreenKey, new sBind(a, CLASSIC_DPAD_LEFT, BIND_BUTTON, CLASSIC_DPAD_LEFT, 1.0f)); AddBind(touchScreenKey, new sBind(a, CLASSIC_DPAD_LEFT, BIND_BUTTON, CLASSIC_DPAD_LEFT, 1.0f));
AddBind(touchScreenKey, new sBind(a, CLASSIC_DPAD_RIGHT, BIND_BUTTON, CLASSIC_DPAD_RIGHT, 1.0f)); AddBind(touchScreenKey,
new sBind(a, CLASSIC_DPAD_RIGHT, BIND_BUTTON, CLASSIC_DPAD_RIGHT, 1.0f));
AddBind(touchScreenKey, new sBind(a, CLASSIC_STICK_LEFT_UP, BIND_AXIS, CLASSIC_STICK_LEFT_UP, -1.0f)); AddBind(touchScreenKey,
AddBind(touchScreenKey, new sBind(a, CLASSIC_STICK_LEFT_DOWN, BIND_AXIS, CLASSIC_STICK_LEFT_DOWN, 1.0f)); new sBind(a, CLASSIC_STICK_LEFT_UP, BIND_AXIS, CLASSIC_STICK_LEFT_UP, -1.0f));
AddBind(touchScreenKey, new sBind(a, CLASSIC_STICK_LEFT_LEFT, BIND_AXIS, CLASSIC_STICK_LEFT_LEFT, -1.0f)); AddBind(touchScreenKey,
AddBind(touchScreenKey, new sBind(a, CLASSIC_STICK_LEFT_RIGHT, BIND_AXIS, CLASSIC_STICK_LEFT_RIGHT, 1.0f)); new sBind(a, CLASSIC_STICK_LEFT_DOWN, BIND_AXIS, CLASSIC_STICK_LEFT_DOWN, 1.0f));
AddBind(touchScreenKey, new sBind(a, CLASSIC_STICK_RIGHT_UP, BIND_AXIS, CLASSIC_STICK_RIGHT_UP, -1.0f)); AddBind(touchScreenKey,
AddBind(touchScreenKey, new sBind(a, CLASSIC_STICK_RIGHT_DOWN, BIND_AXIS, CLASSIC_STICK_RIGHT_DOWN, 1.0f)); new sBind(a, CLASSIC_STICK_LEFT_LEFT, BIND_AXIS, CLASSIC_STICK_LEFT_LEFT, -1.0f));
AddBind(touchScreenKey, new sBind(a, CLASSIC_STICK_RIGHT_LEFT, BIND_AXIS, CLASSIC_STICK_RIGHT_LEFT, -1.0f)); AddBind(touchScreenKey,
AddBind(touchScreenKey, new sBind(a, CLASSIC_STICK_RIGHT_RIGHT, BIND_AXIS, CLASSIC_STICK_RIGHT_RIGHT, 1.0f)); new sBind(a, CLASSIC_STICK_LEFT_RIGHT, BIND_AXIS, CLASSIC_STICK_LEFT_RIGHT, 1.0f));
AddBind(touchScreenKey,
new sBind(a, CLASSIC_STICK_RIGHT_UP, BIND_AXIS, CLASSIC_STICK_RIGHT_UP, -1.0f));
AddBind(touchScreenKey,
new sBind(a, CLASSIC_STICK_RIGHT_DOWN, BIND_AXIS, CLASSIC_STICK_RIGHT_DOWN, 1.0f));
AddBind(touchScreenKey,
new sBind(a, CLASSIC_STICK_RIGHT_LEFT, BIND_AXIS, CLASSIC_STICK_RIGHT_LEFT, -1.0f));
AddBind(touchScreenKey,
new sBind(a, CLASSIC_STICK_RIGHT_RIGHT, BIND_AXIS, CLASSIC_STICK_RIGHT_RIGHT, 1.0f));
AddBind(touchScreenKey, new sBind(a, CLASSIC_TRIGGER_L, BIND_AXIS, CLASSIC_TRIGGER_L, 1.0f)); AddBind(touchScreenKey, new sBind(a, CLASSIC_TRIGGER_L, BIND_AXIS, CLASSIC_TRIGGER_L, 1.0f));
AddBind(touchScreenKey, new sBind(a, CLASSIC_TRIGGER_R, BIND_AXIS, CLASSIC_TRIGGER_R, 1.0f)); AddBind(touchScreenKey, new sBind(a, CLASSIC_TRIGGER_R, BIND_AXIS, CLASSIC_TRIGGER_R, 1.0f));
// Wii: Guitar // Wii: Guitar
AddBind(touchScreenKey, new sBind(a, GUITAR_BUTTON_MINUS, BIND_BUTTON, GUITAR_BUTTON_MINUS, 1.0f)); AddBind(touchScreenKey,
AddBind(touchScreenKey, new sBind(a, GUITAR_BUTTON_PLUS, BIND_BUTTON, GUITAR_BUTTON_PLUS, 1.0f)); new sBind(a, GUITAR_BUTTON_MINUS, BIND_BUTTON, GUITAR_BUTTON_MINUS, 1.0f));
AddBind(touchScreenKey,
new sBind(a, GUITAR_BUTTON_PLUS, BIND_BUTTON, GUITAR_BUTTON_PLUS, 1.0f));
AddBind(touchScreenKey, new sBind(a, GUITAR_FRET_GREEN, BIND_BUTTON, GUITAR_FRET_GREEN, 1.0f)); AddBind(touchScreenKey, new sBind(a, GUITAR_FRET_GREEN, BIND_BUTTON, GUITAR_FRET_GREEN, 1.0f));
AddBind(touchScreenKey, new sBind(a, GUITAR_FRET_RED, BIND_BUTTON, GUITAR_FRET_RED, 1.0f)); AddBind(touchScreenKey, new sBind(a, GUITAR_FRET_RED, BIND_BUTTON, GUITAR_FRET_RED, 1.0f));
AddBind(touchScreenKey, new sBind(a, GUITAR_FRET_YELLOW, BIND_BUTTON, GUITAR_FRET_YELLOW, 1.0f)); AddBind(touchScreenKey,
new sBind(a, GUITAR_FRET_YELLOW, BIND_BUTTON, GUITAR_FRET_YELLOW, 1.0f));
AddBind(touchScreenKey, new sBind(a, GUITAR_FRET_BLUE, BIND_BUTTON, GUITAR_FRET_BLUE, 1.0f)); AddBind(touchScreenKey, new sBind(a, GUITAR_FRET_BLUE, BIND_BUTTON, GUITAR_FRET_BLUE, 1.0f));
AddBind(touchScreenKey, new sBind(a, GUITAR_FRET_ORANGE, BIND_BUTTON, GUITAR_FRET_ORANGE, 1.0f)); AddBind(touchScreenKey,
new sBind(a, GUITAR_FRET_ORANGE, BIND_BUTTON, GUITAR_FRET_ORANGE, 1.0f));
AddBind(touchScreenKey, new sBind(a, GUITAR_STRUM_UP, BIND_BUTTON, GUITAR_STRUM_UP, 1.0f)); AddBind(touchScreenKey, new sBind(a, GUITAR_STRUM_UP, BIND_BUTTON, GUITAR_STRUM_UP, 1.0f));
AddBind(touchScreenKey, new sBind(a, GUITAR_STRUM_DOWN, BIND_BUTTON, GUITAR_STRUM_DOWN, 1.0f)); AddBind(touchScreenKey, new sBind(a, GUITAR_STRUM_DOWN, BIND_BUTTON, GUITAR_STRUM_DOWN, 1.0f));
@ -458,7 +271,8 @@ namespace ButtonManager
AddBind(touchScreenKey, new sBind(a, GUITAR_WHAMMY_BAR, BIND_AXIS, GUITAR_WHAMMY_BAR, 1.0f)); AddBind(touchScreenKey, new sBind(a, GUITAR_WHAMMY_BAR, BIND_AXIS, GUITAR_WHAMMY_BAR, 1.0f));
// Wii: Drums // Wii: Drums
AddBind(touchScreenKey, new sBind(a, DRUMS_BUTTON_MINUS, BIND_BUTTON, DRUMS_BUTTON_MINUS, 1.0f)); AddBind(touchScreenKey,
new sBind(a, DRUMS_BUTTON_MINUS, BIND_BUTTON, DRUMS_BUTTON_MINUS, 1.0f));
AddBind(touchScreenKey, new sBind(a, DRUMS_BUTTON_PLUS, BIND_BUTTON, DRUMS_BUTTON_PLUS, 1.0f)); AddBind(touchScreenKey, new sBind(a, DRUMS_BUTTON_PLUS, BIND_BUTTON, DRUMS_BUTTON_PLUS, 1.0f));
AddBind(touchScreenKey, new sBind(a, DRUMS_PAD_RED, BIND_BUTTON, DRUMS_PAD_RED, 1.0f)); AddBind(touchScreenKey, new sBind(a, DRUMS_PAD_RED, BIND_BUTTON, DRUMS_PAD_RED, 1.0f));
AddBind(touchScreenKey, new sBind(a, DRUMS_PAD_YELLOW, BIND_BUTTON, DRUMS_PAD_YELLOW, 1.0f)); AddBind(touchScreenKey, new sBind(a, DRUMS_PAD_YELLOW, BIND_BUTTON, DRUMS_PAD_YELLOW, 1.0f));
@ -473,28 +287,48 @@ namespace ButtonManager
AddBind(touchScreenKey, new sBind(a, DRUMS_STICK_RIGHT, BIND_AXIS, DRUMS_STICK_RIGHT, 1.0f)); AddBind(touchScreenKey, new sBind(a, DRUMS_STICK_RIGHT, BIND_AXIS, DRUMS_STICK_RIGHT, 1.0f));
// Wii: Turntable // Wii: Turntable
AddBind(touchScreenKey, new sBind(a, TURNTABLE_BUTTON_GREEN_LEFT, BIND_BUTTON, TURNTABLE_BUTTON_GREEN_LEFT, 1.0f)); AddBind(touchScreenKey, new sBind(a, TURNTABLE_BUTTON_GREEN_LEFT, BIND_BUTTON,
AddBind(touchScreenKey, new sBind(a, TURNTABLE_BUTTON_RED_LEFT, BIND_BUTTON, TURNTABLE_BUTTON_RED_LEFT, 1.0f)); TURNTABLE_BUTTON_GREEN_LEFT, 1.0f));
AddBind(touchScreenKey, new sBind(a, TURNTABLE_BUTTON_BLUE_LEFT, BIND_BUTTON, TURNTABLE_BUTTON_BLUE_LEFT, 1.0f)); AddBind(touchScreenKey,
AddBind(touchScreenKey, new sBind(a, TURNTABLE_BUTTON_GREEN_RIGHT, BIND_BUTTON, TURNTABLE_BUTTON_GREEN_RIGHT, 1.0f)); new sBind(a, TURNTABLE_BUTTON_RED_LEFT, BIND_BUTTON, TURNTABLE_BUTTON_RED_LEFT, 1.0f));
AddBind(touchScreenKey, new sBind(a, TURNTABLE_BUTTON_RED_RIGHT, BIND_BUTTON, TURNTABLE_BUTTON_RED_RIGHT, 1.0f)); AddBind(touchScreenKey, new sBind(a, TURNTABLE_BUTTON_BLUE_LEFT, BIND_BUTTON,
AddBind(touchScreenKey, new sBind(a, TURNTABLE_BUTTON_BLUE_RIGHT, BIND_BUTTON, TURNTABLE_BUTTON_BLUE_RIGHT, 1.0f)); TURNTABLE_BUTTON_BLUE_LEFT, 1.0f));
AddBind(touchScreenKey, new sBind(a, TURNTABLE_BUTTON_MINUS, BIND_BUTTON, TURNTABLE_BUTTON_MINUS, 1.0f)); AddBind(touchScreenKey, new sBind(a, TURNTABLE_BUTTON_GREEN_RIGHT, BIND_BUTTON,
AddBind(touchScreenKey, new sBind(a, TURNTABLE_BUTTON_PLUS, BIND_BUTTON, TURNTABLE_BUTTON_PLUS, 1.0f)); TURNTABLE_BUTTON_GREEN_RIGHT, 1.0f));
AddBind(touchScreenKey, new sBind(a, TURNTABLE_BUTTON_HOME, BIND_BUTTON, TURNTABLE_BUTTON_HOME, 1.0f)); AddBind(touchScreenKey, new sBind(a, TURNTABLE_BUTTON_RED_RIGHT, BIND_BUTTON,
AddBind(touchScreenKey, new sBind(a, TURNTABLE_BUTTON_EUPHORIA, BIND_BUTTON, TURNTABLE_BUTTON_EUPHORIA, 1.0f)); TURNTABLE_BUTTON_RED_RIGHT, 1.0f));
AddBind(touchScreenKey, new sBind(a, TURNTABLE_BUTTON_BLUE_RIGHT, BIND_BUTTON,
TURNTABLE_BUTTON_BLUE_RIGHT, 1.0f));
AddBind(touchScreenKey,
new sBind(a, TURNTABLE_BUTTON_MINUS, BIND_BUTTON, TURNTABLE_BUTTON_MINUS, 1.0f));
AddBind(touchScreenKey,
new sBind(a, TURNTABLE_BUTTON_PLUS, BIND_BUTTON, TURNTABLE_BUTTON_PLUS, 1.0f));
AddBind(touchScreenKey,
new sBind(a, TURNTABLE_BUTTON_HOME, BIND_BUTTON, TURNTABLE_BUTTON_HOME, 1.0f));
AddBind(touchScreenKey,
new sBind(a, TURNTABLE_BUTTON_EUPHORIA, BIND_BUTTON, TURNTABLE_BUTTON_EUPHORIA, 1.0f));
AddBind(touchScreenKey, new sBind(a, TURNTABLE_TABLE_LEFT_LEFT, BIND_AXIS, TURNTABLE_TABLE_LEFT_LEFT, -1.0f)); AddBind(touchScreenKey,
AddBind(touchScreenKey, new sBind(a, TURNTABLE_TABLE_LEFT_RIGHT, BIND_AXIS, TURNTABLE_TABLE_LEFT_RIGHT, 1.0f)); new sBind(a, TURNTABLE_TABLE_LEFT_LEFT, BIND_AXIS, TURNTABLE_TABLE_LEFT_LEFT, -1.0f));
AddBind(touchScreenKey, new sBind(a, TURNTABLE_TABLE_RIGHT_LEFT, BIND_AXIS, TURNTABLE_TABLE_RIGHT_LEFT, -1.0f)); AddBind(touchScreenKey,
AddBind(touchScreenKey, new sBind(a, TURNTABLE_TABLE_RIGHT_RIGHT, BIND_AXIS, TURNTABLE_TABLE_RIGHT_RIGHT, 1.0f)); new sBind(a, TURNTABLE_TABLE_LEFT_RIGHT, BIND_AXIS, TURNTABLE_TABLE_LEFT_RIGHT, 1.0f));
AddBind(touchScreenKey,
new sBind(a, TURNTABLE_TABLE_RIGHT_LEFT, BIND_AXIS, TURNTABLE_TABLE_RIGHT_LEFT, -1.0f));
AddBind(touchScreenKey, new sBind(a, TURNTABLE_TABLE_RIGHT_RIGHT, BIND_AXIS,
TURNTABLE_TABLE_RIGHT_RIGHT, 1.0f));
AddBind(touchScreenKey, new sBind(a, TURNTABLE_STICK_UP, BIND_AXIS, TURNTABLE_STICK_UP, -1.0f)); AddBind(touchScreenKey, new sBind(a, TURNTABLE_STICK_UP, BIND_AXIS, TURNTABLE_STICK_UP, -1.0f));
AddBind(touchScreenKey, new sBind(a, TURNTABLE_STICK_DOWN, BIND_AXIS, TURNTABLE_STICK_DOWN, 1.0f)); AddBind(touchScreenKey,
AddBind(touchScreenKey, new sBind(a, TURNTABLE_STICK_LEFT, BIND_AXIS, TURNTABLE_STICK_LEFT, -1.0f)); new sBind(a, TURNTABLE_STICK_DOWN, BIND_AXIS, TURNTABLE_STICK_DOWN, 1.0f));
AddBind(touchScreenKey, new sBind(a, TURNTABLE_STICK_RIGHT, BIND_AXIS, TURNTABLE_STICK_RIGHT, 1.0f)); AddBind(touchScreenKey,
AddBind(touchScreenKey, new sBind(a, TURNTABLE_EFFECT_DIAL, BIND_AXIS, TURNTABLE_EFFECT_DIAL, 1.0f)); new sBind(a, TURNTABLE_STICK_LEFT, BIND_AXIS, TURNTABLE_STICK_LEFT, -1.0f));
AddBind(touchScreenKey, new sBind(a, TURNTABLE_CROSSFADE_LEFT, BIND_AXIS, TURNTABLE_CROSSFADE_LEFT, -1.0f)); AddBind(touchScreenKey,
AddBind(touchScreenKey, new sBind(a, TURNTABLE_CROSSFADE_RIGHT, BIND_AXIS, TURNTABLE_CROSSFADE_RIGHT, 1.0f)); new sBind(a, TURNTABLE_STICK_RIGHT, BIND_AXIS, TURNTABLE_STICK_RIGHT, 1.0f));
AddBind(touchScreenKey,
new sBind(a, TURNTABLE_EFFECT_DIAL, BIND_AXIS, TURNTABLE_EFFECT_DIAL, 1.0f));
AddBind(touchScreenKey,
new sBind(a, TURNTABLE_CROSSFADE_LEFT, BIND_AXIS, TURNTABLE_CROSSFADE_LEFT, -1.0f));
AddBind(touchScreenKey,
new sBind(a, TURNTABLE_CROSSFADE_RIGHT, BIND_AXIS, TURNTABLE_CROSSFADE_RIGHT, 1.0f));
} }
// Init our controller bindings // Init our controller bindings
IniFile ini; IniFile ini;
@ -527,22 +361,22 @@ namespace ButtonManager
sscanf(value.c_str(), "Device '%127[^\']'-Button %d", dev, &bindnum); sscanf(value.c_str(), "Device '%127[^\']'-Button %d", dev, &bindnum);
} }
if (hasbind) if (hasbind)
AddBind(std::string(dev), new sBind(padID, configTypes[a], type, bindnum, modifier == '-' ? -1.0f : 1.0f)); AddBind(std::string(dev),
new sBind(padID, configTypes[a], type, bindnum, modifier == '-' ? -1.0f : 1.0f));
} }
} }
}
} bool GetButtonPressed(int padID, ButtonType button)
bool GetButtonPressed(int padID, ButtonType button) {
{
bool pressed = m_controllers[touchScreenKey]->ButtonValue(padID, button); bool pressed = m_controllers[touchScreenKey]->ButtonValue(padID, button);
for (const auto& ctrl : m_controllers) for (const auto& ctrl : m_controllers)
pressed |= ctrl.second->ButtonValue(padID, button); pressed |= ctrl.second->ButtonValue(padID, button);
return pressed; return pressed;
} }
float GetAxisValue(int padID, ButtonType axis) float GetAxisValue(int padID, ButtonType axis)
{ {
float value = m_controllers[touchScreenKey]->AxisValue(padID, axis); float value = m_controllers[touchScreenKey]->AxisValue(padID, axis);
if (value == 0.0f) if (value == 0.0f)
{ {
@ -554,30 +388,30 @@ namespace ButtonManager
} }
} }
return value; return value;
} }
bool GamepadEvent(const std::string& dev, int button, int action) bool GamepadEvent(const std::string& dev, int button, int action)
{ {
auto it = m_controllers.find(dev); auto it = m_controllers.find(dev);
if (it != m_controllers.end()) if (it != m_controllers.end())
return it->second->PressEvent(button, action); return it->second->PressEvent(button, action);
return false; return false;
} }
void GamepadAxisEvent(const std::string& dev, int axis, float value) void GamepadAxisEvent(const std::string& dev, int axis, float value)
{ {
auto it = m_controllers.find(dev); auto it = m_controllers.find(dev);
if (it != m_controllers.end()) if (it != m_controllers.end())
it->second->AxisEvent(axis, value); it->second->AxisEvent(axis, value);
} }
void Shutdown() void Shutdown()
{ {
for (const auto& controller : m_controllers) for (const auto& controller : m_controllers)
delete controller.second; delete controller.second;
m_controllers.clear(); m_controllers.clear();
} }
// InputDevice // InputDevice
bool InputDevice::PressEvent(int button, int action) bool InputDevice::PressEvent(int button, int action)
{ {
bool handled = false; bool handled = false;
for (const auto& binding : _inputbinds) for (const auto& binding : _inputbinds)
{ {
@ -591,9 +425,9 @@ namespace ButtonManager
} }
} }
return handled; return handled;
} }
void InputDevice::AxisEvent(int axis, float value) void InputDevice::AxisEvent(int axis, float value)
{ {
for (const auto& binding : _inputbinds) for (const auto& binding : _inputbinds)
{ {
if (binding.second->_bind == axis) if (binding.second->_bind == axis)
@ -604,9 +438,9 @@ namespace ButtonManager
_buttons[binding.second->_buttontype] = value > 0.5f ? true : false; _buttons[binding.second->_buttontype] = value > 0.5f ? true : false;
} }
} }
} }
bool InputDevice::ButtonValue(int padID, ButtonType button) bool InputDevice::ButtonValue(int padID, ButtonType button)
{ {
const auto& binding = _inputbinds.find(std::make_pair(padID, button)); const auto& binding = _inputbinds.find(std::make_pair(padID, button));
if (binding == _inputbinds.end()) if (binding == _inputbinds.end())
return false; return false;
@ -615,9 +449,9 @@ namespace ButtonManager
return _buttons[binding->second->_buttontype]; return _buttons[binding->second->_buttontype];
else else
return (_axises[binding->second->_buttontype] * binding->second->_neg) > 0.5f; return (_axises[binding->second->_buttontype] * binding->second->_neg) > 0.5f;
} }
float InputDevice::AxisValue(int padID, ButtonType axis) float InputDevice::AxisValue(int padID, ButtonType axis)
{ {
const auto& binding = _inputbinds.find(std::make_pair(padID, axis)); const auto& binding = _inputbinds.find(std::make_pair(padID, axis));
if (binding == _inputbinds.end()) if (binding == _inputbinds.end())
return 0.0f; return 0.0f;
@ -626,5 +460,5 @@ namespace ButtonManager
return _axises[binding->second->_buttontype] * binding->second->_neg; return _axises[binding->second->_buttontype] * binding->second->_neg;
else else
return _buttons[binding->second->_buttontype] == BUTTON_PRESSED ? 1.0f : 0.0f; return _buttons[binding->second->_buttontype] == BUTTON_PRESSED ? 1.0f : 0.0f;
} }
} }

View File

@ -9,8 +9,8 @@
namespace ButtonManager namespace ButtonManager
{ {
enum ButtonType enum ButtonType
{ {
// GC // GC
BUTTON_A = 0, BUTTON_A = 0,
BUTTON_B = 1, BUTTON_B = 1,
@ -70,7 +70,7 @@ namespace ButtonManager
WIIMOTE_SHAKE_X = 132, WIIMOTE_SHAKE_X = 132,
WIIMOTE_SHAKE_Y = 133, WIIMOTE_SHAKE_Y = 133,
WIIMOTE_SHAKE_Z = 134, WIIMOTE_SHAKE_Z = 134,
//Nunchuk // Nunchuk
NUNCHUK_BUTTON_C = 200, NUNCHUK_BUTTON_C = 200,
NUNCHUK_BUTTON_Z = 201, NUNCHUK_BUTTON_Z = 201,
NUNCHUK_STICK = 202, // To Be Used on Java Side NUNCHUK_STICK = 202, // To Be Used on Java Side
@ -94,7 +94,7 @@ namespace ButtonManager
NUNCHUK_SHAKE_X = 220, NUNCHUK_SHAKE_X = 220,
NUNCHUK_SHAKE_Y = 221, NUNCHUK_SHAKE_Y = 221,
NUNCHUK_SHAKE_Z = 222, NUNCHUK_SHAKE_Z = 222,
//Classic // Classic
CLASSIC_BUTTON_A = 300, CLASSIC_BUTTON_A = 300,
CLASSIC_BUTTON_B = 301, CLASSIC_BUTTON_B = 301,
CLASSIC_BUTTON_X = 302, CLASSIC_BUTTON_X = 302,
@ -120,7 +120,7 @@ namespace ButtonManager
CLASSIC_STICK_RIGHT_RIGHT = 322, CLASSIC_STICK_RIGHT_RIGHT = 322,
CLASSIC_TRIGGER_L = 323, CLASSIC_TRIGGER_L = 323,
CLASSIC_TRIGGER_R = 324, CLASSIC_TRIGGER_R = 324,
//Guitar // Guitar
GUITAR_BUTTON_MINUS = 400, GUITAR_BUTTON_MINUS = 400,
GUITAR_BUTTON_PLUS = 401, GUITAR_BUTTON_PLUS = 401,
GUITAR_FRET_GREEN = 402, GUITAR_FRET_GREEN = 402,
@ -136,7 +136,7 @@ namespace ButtonManager
GUITAR_STICK_LEFT = 412, GUITAR_STICK_LEFT = 412,
GUITAR_STICK_RIGHT = 413, GUITAR_STICK_RIGHT = 413,
GUITAR_WHAMMY_BAR = 414, GUITAR_WHAMMY_BAR = 414,
//Drums // Drums
DRUMS_BUTTON_MINUS = 500, DRUMS_BUTTON_MINUS = 500,
DRUMS_BUTTON_PLUS = 501, DRUMS_BUTTON_PLUS = 501,
DRUMS_PAD_RED = 502, DRUMS_PAD_RED = 502,
@ -150,7 +150,7 @@ namespace ButtonManager
DRUMS_STICK_DOWN = 510, DRUMS_STICK_DOWN = 510,
DRUMS_STICK_LEFT = 511, DRUMS_STICK_LEFT = 511,
DRUMS_STICK_RIGHT = 512, DRUMS_STICK_RIGHT = 512,
//Turntable // Turntable
TURNTABLE_BUTTON_GREEN_LEFT = 600, TURNTABLE_BUTTON_GREEN_LEFT = 600,
TURNTABLE_BUTTON_RED_LEFT = 601, TURNTABLE_BUTTON_RED_LEFT = 601,
TURNTABLE_BUTTON_BLUE_LEFT = 602, TURNTABLE_BUTTON_BLUE_LEFT = 602,
@ -176,42 +176,42 @@ namespace ButtonManager
TURNTABLE_CROSSFADE = 622, // To Be Used on Java Side TURNTABLE_CROSSFADE = 622, // To Be Used on Java Side
TURNTABLE_CROSSFADE_LEFT = 623, TURNTABLE_CROSSFADE_LEFT = 623,
TURNTABLE_CROSSFADE_RIGHT = 624, TURNTABLE_CROSSFADE_RIGHT = 624,
}; };
enum ButtonState enum ButtonState
{ {
BUTTON_RELEASED = 0, BUTTON_RELEASED = 0,
BUTTON_PRESSED = 1 BUTTON_PRESSED = 1
}; };
enum BindType enum BindType
{ {
BIND_BUTTON = 0, BIND_BUTTON = 0,
BIND_AXIS BIND_AXIS
}; };
class Button class Button
{ {
private: private:
ButtonState m_state; ButtonState m_state;
public:
public:
Button() : m_state(BUTTON_RELEASED) {} Button() : m_state(BUTTON_RELEASED) {}
void SetState(ButtonState state) { m_state = state; } void SetState(ButtonState state) { m_state = state; }
bool Pressed() { return m_state == BUTTON_PRESSED; } bool Pressed() { return m_state == BUTTON_PRESSED; }
~Button() {} ~Button() {}
}; };
class Axis class Axis
{ {
private: private:
float m_value; float m_value;
public:
public:
Axis() : m_value(0.0f) {} Axis() : m_value(0.0f) {}
void SetValue(float value) { m_value = value; } void SetValue(float value) { m_value = value; }
float AxisValue() { return m_value; } float AxisValue() { return m_value; }
~Axis() {} ~Axis() {}
}; };
struct sBind struct sBind
{ {
const int _padID; const int _padID;
const ButtonType _buttontype; const ButtonType _buttontype;
const BindType _bindtype; const BindType _bindtype;
@ -219,22 +219,22 @@ namespace ButtonManager
const float _neg; const float _neg;
sBind(int padID, ButtonType buttontype, BindType bindtype, int bind, float neg) sBind(int padID, ButtonType buttontype, BindType bindtype, int bind, float neg)
: _padID(padID), _buttontype(buttontype), _bindtype(bindtype), _bind(bind), _neg(neg) : _padID(padID), _buttontype(buttontype), _bindtype(bindtype), _bind(bind), _neg(neg)
{}
};
class InputDevice
{ {
private: }
};
class InputDevice
{
private:
const std::string _dev; const std::string _dev;
std::map<ButtonType, bool> _buttons; std::map<ButtonType, bool> _buttons;
std::map<ButtonType, float> _axises; std::map<ButtonType, float> _axises;
// Key is padID and ButtonType // Key is padID and ButtonType
std::map<std::pair<int, ButtonType>, sBind*> _inputbinds; std::map<std::pair<int, ButtonType>, sBind*> _inputbinds;
public:
InputDevice(std::string dev) public:
: _dev(dev) {} InputDevice(std::string dev) : _dev(dev) {}
~InputDevice() ~InputDevice()
{ {
for (const auto& bind : _inputbinds) for (const auto& bind : _inputbinds)
@ -246,12 +246,12 @@ namespace ButtonManager
void AxisEvent(int axis, float value); void AxisEvent(int axis, float value);
bool ButtonValue(int padID, ButtonType button); bool ButtonValue(int padID, ButtonType button);
float AxisValue(int padID, ButtonType axis); float AxisValue(int padID, ButtonType axis);
}; };
void Init(); void Init();
bool GetButtonPressed(int padID, ButtonType button); bool GetButtonPressed(int padID, ButtonType button);
float GetAxisValue(int padID, ButtonType axis); float GetAxisValue(int padID, ButtonType axis);
bool GamepadEvent(const std::string& dev, int button, int action); bool GamepadEvent(const std::string& dev, int button, int action);
void GamepadAxisEvent(const std::string& dev, int axis, float value); void GamepadAxisEvent(const std::string& dev, int axis, float value);
void Shutdown(); void Shutdown();
} }

View File

@ -2,6 +2,9 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <EGL/egl.h>
#include <android/log.h>
#include <android/native_window_jni.h>
#include <cinttypes> #include <cinttypes>
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
@ -9,15 +12,12 @@
#include <memory> #include <memory>
#include <mutex> #include <mutex>
#include <thread> #include <thread>
#include <android/log.h>
#include <android/native_window_jni.h>
#include <EGL/egl.h>
#include "ButtonManager.h" #include "ButtonManager.h"
#include "Common/CPUDetect.h"
#include "Common/CommonPaths.h" #include "Common/CommonPaths.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/CPUDetect.h"
#include "Common/Event.h" #include "Common/Event.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/GL/GLInterfaceBase.h" #include "Common/GL/GLInterfaceBase.h"
@ -26,12 +26,12 @@
#include "Core/BootManager.h" #include "Core/BootManager.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Core.h" #include "Core/Core.h"
#include "Core/Host.h"
#include "Core/State.h"
#include "Core/HW/Wiimote.h" #include "Core/HW/Wiimote.h"
#include "Core/HW/WiimoteReal/WiimoteReal.h" #include "Core/HW/WiimoteReal/WiimoteReal.h"
#include "Core/Host.h"
#include "Core/PowerPC/JitInterface.h" #include "Core/PowerPC/JitInterface.h"
#include "Core/PowerPC/Profiler.h" #include "Core/PowerPC/Profiler.h"
#include "Core/State.h"
#include "DiscIO/Volume.h" #include "DiscIO/Volume.h"
#include "DiscIO/VolumeCreator.h" #include "DiscIO/VolumeCreator.h"
@ -63,8 +63,12 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved)
return JNI_VERSION_1_6; return JNI_VERSION_1_6;
} }
void Host_NotifyMapLoaded() {} void Host_NotifyMapLoaded()
void Host_RefreshDSPDebuggerWindow() {} {
}
void Host_RefreshDSPDebuggerWindow()
{
}
// The Core only supports using a single Host thread. // The Core only supports using a single Host thread.
// If multiple threads want to call host functions then they need to queue // If multiple threads want to call host functions then they need to queue
@ -96,15 +100,21 @@ void Host_UpdateTitle(const std::string& title)
__android_log_write(ANDROID_LOG_INFO, DOLPHIN_TAG, title.c_str()); __android_log_write(ANDROID_LOG_INFO, DOLPHIN_TAG, title.c_str());
} }
void Host_UpdateDisasmDialog(){} void Host_UpdateDisasmDialog()
{
}
void Host_UpdateMainFrame() void Host_UpdateMainFrame()
{ {
} }
void Host_RequestRenderWindowSize(int width, int height) {} void Host_RequestRenderWindowSize(int width, int height)
{
}
void Host_RequestFullscreen(bool enable_fullscreen) {} void Host_RequestFullscreen(bool enable_fullscreen)
{
}
void Host_SetStartupDebuggingParameters() void Host_SetStartupDebuggingParameters()
{ {
@ -125,11 +135,17 @@ bool Host_RendererIsFullscreen()
return false; return false;
} }
void Host_ConnectWiimote(int wm_idx, bool connect) {} void Host_ConnectWiimote(int wm_idx, bool connect)
{
}
void Host_SetWiiMoteConnectionState(int _State) {} void Host_SetWiiMoteConnectionState(int _State)
{
}
void Host_ShowVideoConfig(void*, const std::string&, const std::string&) {} void Host_ShowVideoConfig(void*, const std::string&, const std::string&)
{
}
static bool MsgAlert(const char* caption, const char* text, bool yes_no, int /*Style*/) static bool MsgAlert(const char* caption, const char* text, bool yes_no, int /*Style*/)
{ {
@ -151,18 +167,22 @@ static bool MsgAlert(const char* caption, const char* text, bool yes_no, int /*S
#define DVD_BANNER_WIDTH 96 #define DVD_BANNER_WIDTH 96
#define DVD_BANNER_HEIGHT 32 #define DVD_BANNER_HEIGHT 32
static inline u32 Average32(u32 a, u32 b) { static inline u32 Average32(u32 a, u32 b)
{
return ((a >> 1) & 0x7f7f7f7f) + ((b >> 1) & 0x7f7f7f7f); return ((a >> 1) & 0x7f7f7f7f) + ((b >> 1) & 0x7f7f7f7f);
} }
static inline u32 GetPixel(u32 *buffer, unsigned int x, unsigned int y) { static inline u32 GetPixel(u32* buffer, unsigned int x, unsigned int y)
{
// thanks to unsignedness, these also check for <0 automatically. // thanks to unsignedness, these also check for <0 automatically.
if (x > 191) return 0; if (x > 191)
if (y > 63) return 0; return 0;
if (y > 63)
return 0;
return buffer[y * 192 + x]; return buffer[y * 192 + x];
} }
static bool LoadBanner(std::string filename, u32 *Banner) static bool LoadBanner(std::string filename, u32* Banner)
{ {
std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(filename)); std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(filename));
@ -183,9 +203,9 @@ static bool LoadBanner(std::string filename, u32 *Banner)
{ {
// simplified plus-shaped "gaussian" // simplified plus-shaped "gaussian"
u32 surround = Average32( u32 surround = Average32(
Average32(GetPixel(Buffer, x*2 - 1, y*2), GetPixel(Buffer, x*2 + 1, y*2)), Average32(GetPixel(Buffer, x * 2 - 1, y * 2), GetPixel(Buffer, x * 2 + 1, y * 2)),
Average32(GetPixel(Buffer, x*2, y*2 - 1), GetPixel(Buffer, x*2, y*2 + 1))); Average32(GetPixel(Buffer, x * 2, y * 2 - 1), GetPixel(Buffer, x * 2, y * 2 + 1)));
Banner[y * 96 + x] = Average32(GetPixel(Buffer, x*2, y*2), surround); Banner[y * 96 + x] = Average32(GetPixel(Buffer, x * 2, y * 2), surround);
} }
} }
return true; return true;
@ -242,12 +262,14 @@ static int GetPlatform(std::string filename)
static std::string GetTitle(std::string filename) static std::string GetTitle(std::string filename)
{ {
__android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting Title for file: %s", filename.c_str()); __android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting Title for file: %s",
filename.c_str());
std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(filename)); std::unique_ptr<DiscIO::IVolume> pVolume(DiscIO::CreateVolumeFromFilename(filename));
if (pVolume != nullptr) { if (pVolume != nullptr)
std::map <DiscIO::IVolume::ELanguage, std::string> titles = pVolume->GetNames(true); {
std::map<DiscIO::IVolume::ELanguage, std::string> titles = pVolume->GetNames(true);
/* /*
bool is_wii_title = pVolume->GetVolumeType() != DiscIO::IVolume::GAMECUBE_DISC; bool is_wii_title = pVolume->GetVolumeType() != DiscIO::IVolume::GAMECUBE_DISC;
@ -260,13 +282,12 @@ static std::string GetTitle(std::string filename)
auto end = titles.end(); auto end = titles.end();
// English tends to be a good fallback when the requested language isn't available // English tends to be a good fallback when the requested language isn't available
//if (language != DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH) { // if (language != DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH) {
auto it = titles.find(DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH); auto it = titles.find(DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH);
if (it != end) if (it != end)
return it->second; return it->second;
//} //}
// If English isn't available either, just pick something // If English isn't available either, just pick something
if (!titles.empty()) if (!titles.empty())
return titles.cbegin()->second; return titles.cbegin()->second;
@ -277,12 +298,13 @@ static std::string GetTitle(std::string filename)
return name; return name;
} }
return std::string (""); return std::string("");
} }
static std::string GetDescription(std::string filename) static std::string GetDescription(std::string filename)
{ {
__android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting Description for file: %s", filename.c_str()); __android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting Description for file: %s",
filename.c_str());
std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(filename)); std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(filename));
@ -301,7 +323,7 @@ static std::string GetDescription(std::string filename)
auto end = descriptions.end(); auto end = descriptions.end();
// English tends to be a good fallback when the requested language isn't available // English tends to be a good fallback when the requested language isn't available
//if (language != DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH) { // if (language != DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH) {
auto it = descriptions.find(DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH); auto it = descriptions.find(DiscIO::IVolume::ELanguage::LANGUAGE_ENGLISH);
if (it != end) if (it != end)
return it->second; return it->second;
@ -330,7 +352,8 @@ static std::string GetGameId(std::string filename)
static std::string GetCompany(std::string filename) static std::string GetCompany(std::string filename)
{ {
__android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting Company for file: %s", filename.c_str()); __android_log_print(ANDROID_LOG_WARN, DOLPHIN_TAG, "Getting Company for file: %s",
filename.c_str());
std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(filename)); std::unique_ptr<DiscIO::IVolume> volume(DiscIO::CreateVolumeFromFilename(filename));
if (volume == nullptr) if (volume == nullptr)
@ -354,66 +377,111 @@ static u64 GetFileSize(std::string filename)
return size; return size;
} }
static std::string GetJString(JNIEnv *env, jstring jstr) static std::string GetJString(JNIEnv* env, jstring jstr)
{ {
std::string result = ""; std::string result = "";
if (!jstr) if (!jstr)
return result; return result;
const char *s = env->GetStringUTFChars(jstr, nullptr); const char* s = env->GetStringUTFChars(jstr, nullptr);
result = s; result = s;
env->ReleaseStringUTFChars(jstr, s); env->ReleaseStringUTFChars(jstr, s);
return result; return result;
} }
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C" {
{
#endif #endif
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_UnPauseEmulation(JNIEnv *env, jobject obj); JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_UnPauseEmulation(JNIEnv* env,
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_PauseEmulation(JNIEnv *env, jobject obj); jobject obj);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_StopEmulation(JNIEnv *env, jobject obj); JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_PauseEmulation(JNIEnv* env,
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadEvent(JNIEnv *env, jobject obj, jstring jDevice, jint Button, jint Action); jobject obj);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadMoveEvent(JNIEnv *env, jobject obj, jstring jDevice, jint Axis, jfloat Value); JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_StopEmulation(JNIEnv* env,
JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetBanner(JNIEnv *env, jobject obj, jstring jFile);JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetTitle(JNIEnv *env, jobject obj, jstring jFilename); jobject obj);
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetDescription(JNIEnv *env, jobject obj, jstring jFilename); JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadEvent(
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetGameId(JNIEnv *env, jobject obj, jstring jFilename); JNIEnv* env, jobject obj, jstring jDevice, jint Button, jint Action);
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCountry(JNIEnv *env, jobject obj, jstring jFilename); JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadMoveEvent(
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCompany(JNIEnv *env, jobject obj, jstring jFilename); JNIEnv* env, jobject obj, jstring jDevice, jint Axis, jfloat Value);
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetFilesize(JNIEnv *env, jobject obj, jstring jFilename); JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetBanner(JNIEnv* env,
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetPlatform(JNIEnv *env, jobject obj, jstring jFilename); jobject obj,
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetVersionString(JNIEnv *env, jobject obj); jstring jFile);
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SupportsNEON(JNIEnv *env, jobject obj); JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetTitle(JNIEnv* env,
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveScreenShot(JNIEnv *env, jobject obj); jobject obj,
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_eglBindAPI(JNIEnv *env, jobject obj, jint api); jstring jFilename);
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetConfig(JNIEnv *env, jobject obj, jstring jFile, jstring jSection, jstring jKey, jstring jDefault); JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetDescription(
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetConfig(JNIEnv *env, jobject obj, jstring jFile, jstring jSection, jstring jKey, jstring jValue); JNIEnv* env, jobject obj, jstring jFilename);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetFilename(JNIEnv *env, jobject obj, jstring jFile); JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetGameId(JNIEnv* env,
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveState(JNIEnv *env, jobject obj, jint slot); jobject obj,
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_LoadState(JNIEnv *env, jobject obj, jint slot); jstring jFilename);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_CreateUserFolders(JNIEnv *env, jobject obj); JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCountry(JNIEnv* env,
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetUserDirectory(JNIEnv *env, jobject obj, jstring jDirectory); jobject obj,
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetUserDirectory(JNIEnv *env, jobject obj); jstring jFilename);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetProfiling(JNIEnv *env, jobject obj, jboolean enable); JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCompany(
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfileResults(JNIEnv *env, jobject obj); JNIEnv* env, jobject obj, jstring jFilename);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_CacheClassesAndMethods(JNIEnv *env, jobject obj); JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetFilesize(JNIEnv* env,
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *env, jobject obj); jobject obj,
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceChanged(JNIEnv *env, jobject obj, jobject _surf); jstring jFilename);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceDestroyed(JNIEnv *env, jobject obj); JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetPlatform(JNIEnv* env,
jobject obj,
jstring jFilename);
JNIEXPORT jstring JNICALL
Java_org_dolphinemu_dolphinemu_NativeLibrary_GetVersionString(JNIEnv* env, jobject obj);
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SupportsNEON(JNIEnv* env,
jobject obj);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveScreenShot(JNIEnv* env,
jobject obj);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_eglBindAPI(JNIEnv* env,
jobject obj,
jint api);
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetConfig(
JNIEnv* env, jobject obj, jstring jFile, jstring jSection, jstring jKey, jstring jDefault);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetConfig(
JNIEnv* env, jobject obj, jstring jFile, jstring jSection, jstring jKey, jstring jValue);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetFilename(JNIEnv* env,
jobject obj,
jstring jFile);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveState(JNIEnv* env,
jobject obj,
jint slot);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_LoadState(JNIEnv* env,
jobject obj,
jint slot);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_CreateUserFolders(JNIEnv* env,
jobject obj);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetUserDirectory(
JNIEnv* env, jobject obj, jstring jDirectory);
JNIEXPORT jstring JNICALL
Java_org_dolphinemu_dolphinemu_NativeLibrary_GetUserDirectory(JNIEnv* env, jobject obj);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetProfiling(JNIEnv* env,
jobject obj,
jboolean enable);
JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfileResults(JNIEnv* env, jobject obj);
JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_NativeLibrary_CacheClassesAndMethods(JNIEnv* env, jobject obj);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv* env, jobject obj);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceChanged(JNIEnv* env,
jobject obj,
jobject _surf);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceDestroyed(JNIEnv* env,
jobject obj);
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_UnPauseEmulation(JNIEnv *env, jobject obj) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_UnPauseEmulation(JNIEnv* env,
jobject obj)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
Core::SetState(Core::CORE_RUN); Core::SetState(Core::CORE_RUN);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_PauseEmulation(JNIEnv *env, jobject obj) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_PauseEmulation(JNIEnv* env,
jobject obj)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
Core::SetState(Core::CORE_PAUSE); Core::SetState(Core::CORE_PAUSE);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_StopEmulation(JNIEnv *env, jobject obj) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_StopEmulation(JNIEnv* env,
jobject obj)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
Core::SaveScreenShot("thumb"); Core::SaveScreenShot("thumb");
@ -421,16 +489,20 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_StopEmulatio
Core::Stop(); Core::Stop();
updateMainFrameEvent.Set(); // Kick the waiting event updateMainFrameEvent.Set(); // Kick the waiting event
} }
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadEvent(JNIEnv *env, jobject obj, jstring jDevice, jint Button, jint Action) JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadEvent(
JNIEnv* env, jobject obj, jstring jDevice, jint Button, jint Action)
{ {
return ButtonManager::GamepadEvent(GetJString(env, jDevice), Button, Action); return ButtonManager::GamepadEvent(GetJString(env, jDevice), Button, Action);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadMoveEvent(JNIEnv *env, jobject obj, jstring jDevice, jint Axis, jfloat Value) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_onGamePadMoveEvent(
JNIEnv* env, jobject obj, jstring jDevice, jint Axis, jfloat Value)
{ {
ButtonManager::GamepadAxisEvent(GetJString(env, jDevice), Axis, Value); ButtonManager::GamepadAxisEvent(GetJString(env, jDevice), Axis, Value);
} }
JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetBanner(JNIEnv *env, jobject obj, jstring jFile) JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetBanner(JNIEnv* env,
jobject obj,
jstring jFile)
{ {
std::string file = GetJString(env, jFile); std::string file = GetJString(env, jFile);
u32 uBanner[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT]; u32 uBanner[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT];
@ -443,77 +515,96 @@ JNIEXPORT jintArray JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetBann
return Banner; return Banner;
} }
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetTitle(JNIEnv *env, jobject obj, jstring jFilename) JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetTitle(JNIEnv* env,
jobject obj,
jstring jFilename)
{ {
std::string filename = GetJString(env, jFilename); std::string filename = GetJString(env, jFilename);
std::string name = GetTitle(filename); std::string name = GetTitle(filename);
return env->NewStringUTF(name.c_str()); return env->NewStringUTF(name.c_str());
} }
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetDescription(JNIEnv *env, jobject obj, jstring jFilename) JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetDescription(
JNIEnv* env, jobject obj, jstring jFilename)
{ {
std::string filename = GetJString(env, jFilename); std::string filename = GetJString(env, jFilename);
std::string description = GetDescription(filename); std::string description = GetDescription(filename);
return env->NewStringUTF(description.c_str()); return env->NewStringUTF(description.c_str());
} }
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetGameId(JNIEnv *env, jobject obj, jstring jFilename) JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetGameId(JNIEnv* env,
jobject obj,
jstring jFilename)
{ {
std::string filename = GetJString(env, jFilename); std::string filename = GetJString(env, jFilename);
std::string id = GetGameId(filename); std::string id = GetGameId(filename);
return env->NewStringUTF(id.c_str()); return env->NewStringUTF(id.c_str());
} }
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCompany(JNIEnv *env, jobject obj, jstring jFilename) JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCompany(JNIEnv* env,
jobject obj,
jstring jFilename)
{ {
std::string filename = GetJString(env, jFilename); std::string filename = GetJString(env, jFilename);
std::string company = GetCompany(filename); std::string company = GetCompany(filename);
return env->NewStringUTF(company.c_str()); return env->NewStringUTF(company.c_str());
} }
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCountry(JNIEnv *env, jobject obj, jstring jFilename) JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetCountry(JNIEnv* env,
jobject obj,
jstring jFilename)
{ {
std::string filename = GetJString(env, jFilename); std::string filename = GetJString(env, jFilename);
int country = GetCountry(filename); int country = GetCountry(filename);
return country; return country;
} }
JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetFilesize(JNIEnv *env, jobject obj, jstring jFilename) JNIEXPORT jlong JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetFilesize(JNIEnv* env,
jobject obj,
jstring jFilename)
{ {
std::string filename = GetJString(env, jFilename); std::string filename = GetJString(env, jFilename);
u64 size = GetFileSize(filename); u64 size = GetFileSize(filename);
return size; return size;
} }
JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetPlatform(JNIEnv *env, jobject obj, jstring jFilename) JNIEXPORT jint JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetPlatform(JNIEnv* env,
jobject obj,
jstring jFilename)
{ {
std::string filename = GetJString(env, jFilename); std::string filename = GetJString(env, jFilename);
int platform = GetPlatform(filename); int platform = GetPlatform(filename);
return platform; return platform;
} }
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetVersionString(JNIEnv *env, jobject obj) JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetVersionString(JNIEnv* env,
jobject obj)
{ {
return env->NewStringUTF(scm_rev_str.c_str()); return env->NewStringUTF(scm_rev_str.c_str());
} }
JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SupportsNEON(JNIEnv *env, jobject obj) JNIEXPORT jboolean JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SupportsNEON(JNIEnv* env,
jobject obj)
{ {
return cpu_info.bASIMD; return cpu_info.bASIMD;
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveScreenShot(JNIEnv *env, jobject obj) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveScreenShot(JNIEnv* env,
jobject obj)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
Core::SaveScreenShot(); Core::SaveScreenShot();
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_eglBindAPI(JNIEnv *env, jobject obj, jint api) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_eglBindAPI(JNIEnv* env,
jobject obj,
jint api)
{ {
eglBindAPI(api); eglBindAPI(api);
} }
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetConfig(JNIEnv *env, jobject obj, jstring jFile, jstring jSection, jstring jKey, jstring jDefault) JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetConfig(
JNIEnv* env, jobject obj, jstring jFile, jstring jSection, jstring jKey, jstring jDefault)
{ {
IniFile ini; IniFile ini;
std::string file = GetJString(env, jFile); std::string file = GetJString(env, jFile);
@ -528,7 +619,8 @@ JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetConfig
return env->NewStringUTF(value.c_str()); return env->NewStringUTF(value.c_str());
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetConfig(JNIEnv *env, jobject obj, jstring jFile, jstring jSection, jstring jKey, jstring jValue) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetConfig(
JNIEnv* env, jobject obj, jstring jFile, jstring jSection, jstring jKey, jstring jValue)
{ {
IniFile ini; IniFile ini;
std::string file = GetJString(env, jFile); std::string file = GetJString(env, jFile);
@ -542,29 +634,38 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetConfig(JN
ini.Save(File::GetUserPath(D_CONFIG_IDX) + std::string(file)); ini.Save(File::GetUserPath(D_CONFIG_IDX) + std::string(file));
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetFilename(JNIEnv *env, jobject obj, jstring jFile) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetFilename(JNIEnv* env,
jobject obj,
jstring jFile)
{ {
g_filename = GetJString(env, jFile); g_filename = GetJString(env, jFile);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveState(JNIEnv *env, jobject obj, jint slot) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SaveState(JNIEnv* env,
jobject obj,
jint slot)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
State::Save(slot); State::Save(slot);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_LoadState(JNIEnv *env, jobject obj, jint slot) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_LoadState(JNIEnv* env,
jobject obj,
jint slot)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
State::Load(slot); State::Load(slot);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_CreateUserFolders(JNIEnv *env, jobject obj) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_CreateUserFolders(JNIEnv* env,
jobject obj)
{ {
File::CreateFullPath(File::GetUserPath(D_CONFIG_IDX)); File::CreateFullPath(File::GetUserPath(D_CONFIG_IDX));
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX)); File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX));
File::CreateFullPath(File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP WII_WC24CONF_DIR DIR_SEP "mbox" DIR_SEP); File::CreateFullPath(File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP WII_WC24CONF_DIR DIR_SEP
File::CreateFullPath(File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP "shared2" DIR_SEP "succession" DIR_SEP); "mbox" DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP "shared2" DIR_SEP
"succession" DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP "shared2" DIR_SEP "ec" DIR_SEP); File::CreateFullPath(File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP "shared2" DIR_SEP "ec" DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP WII_SYSCONF_DIR DIR_SEP); File::CreateFullPath(File::GetUserPath(D_WIIROOT_IDX) + DIR_SEP WII_SYSCONF_DIR DIR_SEP);
File::CreateFullPath(File::GetUserPath(D_CACHE_IDX)); File::CreateFullPath(File::GetUserPath(D_CACHE_IDX));
@ -580,7 +681,8 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_CreateUserFo
File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + JAP_DIR DIR_SEP); File::CreateFullPath(File::GetUserPath(D_GCUSER_IDX) + JAP_DIR DIR_SEP);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetUserDirectory(JNIEnv *env, jobject obj, jstring jDirectory) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetUserDirectory(
JNIEnv* env, jobject obj, jstring jDirectory)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
std::string directory = GetJString(env, jDirectory); std::string directory = GetJString(env, jDirectory);
@ -588,12 +690,15 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetUserDirec
UICommon::SetUserDirectory(directory); UICommon::SetUserDirectory(directory);
} }
JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetUserDirectory(JNIEnv *env, jobject obj) JNIEXPORT jstring JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_GetUserDirectory(JNIEnv* env,
jobject obj)
{ {
return env->NewStringUTF(File::GetUserPath(D_USER_IDX).c_str()); return env->NewStringUTF(File::GetUserPath(D_USER_IDX).c_str());
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetProfiling(JNIEnv *env, jobject obj, jboolean enable) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetProfiling(JNIEnv* env,
jobject obj,
jboolean enable)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
Core::SetState(Core::CORE_PAUSE); Core::SetState(Core::CORE_PAUSE);
@ -602,7 +707,8 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SetProfiling
Core::SetState(Core::CORE_RUN); Core::SetState(Core::CORE_RUN);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfileResults(JNIEnv *env, jobject obj) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfileResults(JNIEnv* env,
jobject obj)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
std::string filename = File::GetUserPath(D_DUMP_IDX) + "Debug/profiler.txt"; std::string filename = File::GetUserPath(D_DUMP_IDX) + "Debug/profiler.txt";
@ -610,7 +716,8 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_WriteProfile
JitInterface::WriteProfileResults(filename); JitInterface::WriteProfileResults(filename);
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_CacheClassesAndMethods(JNIEnv *env, jobject obj) JNIEXPORT void JNICALL
Java_org_dolphinemu_dolphinemu_NativeLibrary_CacheClassesAndMethods(JNIEnv* env, jobject obj)
{ {
// This class reference is only valid for the lifetime of this method. // This class reference is only valid for the lifetime of this method.
jclass localClass = env->FindClass("org/dolphinemu/dolphinemu/NativeLibrary"); jclass localClass = env->FindClass("org/dolphinemu/dolphinemu/NativeLibrary");
@ -622,13 +729,17 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_CacheClasses
// So we don't leak a reference to NativeLibrary.class. // So we don't leak a reference to NativeLibrary.class.
// env->DeleteGlobalRef(g_jni_class); // env->DeleteGlobalRef(g_jni_class);
// Method signature taken from javap -s Source/Android/app/build/intermediates/classes/arm/debug/org/dolphinemu/dolphinemu/NativeLibrary.class // Method signature taken from javap -s
g_jni_method_alert = env->GetStaticMethodID(g_jni_class, "displayAlertMsg", "(Ljava/lang/String;)V"); // Source/Android/app/build/intermediates/classes/arm/debug/org/dolphinemu/dolphinemu/NativeLibrary.class
g_jni_method_alert =
env->GetStaticMethodID(g_jni_class, "displayAlertMsg", "(Ljava/lang/String;)V");
g_jni_method_end = env->GetStaticMethodID(g_jni_class, "endEmulationActivity", "()V"); g_jni_method_end = env->GetStaticMethodID(g_jni_class, "endEmulationActivity", "()V");
} }
// Surface Handling // Surface Handling
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceChanged(JNIEnv *env, jobject obj, jobject _surf) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceChanged(JNIEnv* env,
jobject obj,
jobject _surf)
{ {
surf = ANativeWindow_fromSurface(env, _surf); surf = ANativeWindow_fromSurface(env, _surf);
if (surf == nullptr) if (surf == nullptr)
@ -644,7 +755,8 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceChang
} }
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceDestroyed(JNIEnv *env, jobject obj) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceDestroyed(JNIEnv* env,
jobject obj)
{ {
if (surf) if (surf)
{ {
@ -661,13 +773,14 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_SurfaceDestr
Renderer::s_ChangedSurface.Wait(); Renderer::s_ChangedSurface.Wait();
} }
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_RefreshWiimotes(JNIEnv *env, jobject obj) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_RefreshWiimotes(JNIEnv* env,
jobject obj)
{ {
std::lock_guard<std::mutex> guard(s_host_identity_lock); std::lock_guard<std::mutex> guard(s_host_identity_lock);
WiimoteReal::Refresh(); WiimoteReal::Refresh();
} }
JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *env, jobject obj) JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv* env, jobject obj)
{ {
__android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Running : %s", g_filename.c_str()); __android_log_print(ANDROID_LOG_INFO, DOLPHIN_TAG, "Running : %s", g_filename.c_str());
@ -685,7 +798,7 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *
// No use running the loop when booting fails // No use running the loop when booting fails
s_have_wm_user_stop = false; s_have_wm_user_stop = false;
if ( BootManager::BootCore( g_filename.c_str() ) ) if (BootManager::BootCore(g_filename.c_str()))
{ {
static constexpr int TIMEOUT = 10000; static constexpr int TIMEOUT = 10000;
static constexpr int WAIT_STEP = 25; static constexpr int WAIT_STEP = 25;
@ -719,7 +832,6 @@ JNIEXPORT void JNICALL Java_org_dolphinemu_dolphinemu_NativeLibrary_Run(JNIEnv *
env->CallStaticVoidMethod(g_jni_class, g_jni_method_end); env->CallStaticVoidMethod(g_jni_class, g_jni_method_end);
} }
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -6,8 +6,8 @@
#include "AudioCommon/AOSoundStream.h" #include "AudioCommon/AOSoundStream.h"
#include "AudioCommon/Mixer.h" #include "AudioCommon/Mixer.h"
#include "Common/MsgHandler.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#if defined(HAVE_AO) && HAVE_AO #if defined(HAVE_AO) && HAVE_AO
@ -32,7 +32,7 @@ void AOSound::SoundLoop()
return; return;
} }
buf_size = format.bits/8 * format.channels * format.rate; buf_size = format.bits / 8 * format.channels * format.rate;
while (m_run_thread.load()) while (m_run_thread.load())
{ {

View File

@ -26,7 +26,7 @@ class AOSound final : public SoundStream
int buf_size; int buf_size;
ao_device *device; ao_device* device;
ao_sample_format format; ao_sample_format format;
int default_driver; int default_driver;
@ -38,10 +38,6 @@ public:
void Stop() override; void Stop() override;
void Update() override; void Update() override;
static bool isValid() static bool isValid() { return true; }
{
return true;
}
#endif #endif
}; };

View File

@ -6,13 +6,12 @@
#include "AudioCommon/AlsaSoundStream.h" #include "AudioCommon/AlsaSoundStream.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Thread.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/Thread.h"
AlsaSound::AlsaSound() AlsaSound::AlsaSound()
: m_thread_status(ALSAThreadStatus::STOPPED) : m_thread_status(ALSAThreadStatus::STOPPED), handle(nullptr),
, handle(nullptr) frames_to_deliver(FRAME_COUNT_MIN)
, frames_to_deliver(FRAME_COUNT_MIN)
{ {
} }
@ -33,8 +32,8 @@ void AlsaSound::Stop()
{ {
m_thread_status.store(ALSAThreadStatus::STOPPING); m_thread_status.store(ALSAThreadStatus::STOPPING);
//Give the opportunity to the audio thread // Give the opportunity to the audio thread
//to realize we are stopping the emulation // to realize we are stopping the emulation
cv.notify_one(); cv.notify_one();
thread.join(); thread.join();
} }
@ -70,7 +69,7 @@ void AlsaSound::SoundLoop()
// Block until thread status changes. // Block until thread status changes.
std::unique_lock<std::mutex> lock(cv_m); std::unique_lock<std::mutex> lock(cv_m);
cv.wait(lock, [this]{ return m_thread_status.load() != ALSAThreadStatus::PAUSED; }); cv.wait(lock, [this] { return m_thread_status.load() != ALSAThreadStatus::PAUSED; });
snd_pcm_prepare(handle); // resume sound output snd_pcm_prepare(handle); // resume sound output
} }
@ -79,7 +78,6 @@ void AlsaSound::SoundLoop()
m_thread_status.store(ALSAThreadStatus::STOPPED); m_thread_status.store(ALSAThreadStatus::STOPPED);
} }
void AlsaSound::Clear(bool muted) void AlsaSound::Clear(bool muted)
{ {
m_muted = muted; m_muted = muted;
@ -92,9 +90,9 @@ bool AlsaSound::AlsaInit()
unsigned int sample_rate = m_mixer->GetSampleRate(); unsigned int sample_rate = m_mixer->GetSampleRate();
int err; int err;
int dir; int dir;
snd_pcm_sw_params_t *swparams; snd_pcm_sw_params_t* swparams;
snd_pcm_hw_params_t *hwparams; snd_pcm_hw_params_t* hwparams;
snd_pcm_uframes_t buffer_size,buffer_size_max; snd_pcm_uframes_t buffer_size, buffer_size_max;
unsigned int periods; unsigned int periods;
err = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, 0); err = snd_pcm_open(&handle, "default", SND_PCM_STREAM_PLAYBACK, 0);
@ -179,16 +177,18 @@ bool AlsaSound::AlsaInit()
return false; return false;
} }
//periods is the number of fragments alsa can wait for during one // periods is the number of fragments alsa can wait for during one
//buffer_size // buffer_size
frames_to_deliver = buffer_size / periods; frames_to_deliver = buffer_size / periods;
//limit the minimum size. pulseaudio advertises a minimum of 32 samples. // limit the minimum size. pulseaudio advertises a minimum of 32 samples.
if (frames_to_deliver < FRAME_COUNT_MIN) if (frames_to_deliver < FRAME_COUNT_MIN)
frames_to_deliver = FRAME_COUNT_MIN; frames_to_deliver = FRAME_COUNT_MIN;
//it is probably a bad idea to try to send more than one buffer of data // it is probably a bad idea to try to send more than one buffer of data
if ((unsigned int)frames_to_deliver > buffer_size) if ((unsigned int)frames_to_deliver > buffer_size)
frames_to_deliver = buffer_size; frames_to_deliver = buffer_size;
NOTICE_LOG(AUDIO, "ALSA gave us a %ld sample \"hardware\" buffer with %d periods. Will send %d samples per fragments.\n", buffer_size, periods, frames_to_deliver); NOTICE_LOG(AUDIO, "ALSA gave us a %ld sample \"hardware\" buffer with %d periods. Will send %d "
"samples per fragments.\n",
buffer_size, periods, frames_to_deliver);
snd_pcm_sw_params_alloca(&swparams); snd_pcm_sw_params_alloca(&swparams);
@ -232,4 +232,3 @@ void AlsaSound::AlsaShutdown()
handle = nullptr; handle = nullptr;
} }
} }

View File

@ -28,11 +28,7 @@ public:
void Update() override; void Update() override;
void Clear(bool) override; void Clear(bool) override;
static bool isValid() static bool isValid() { return true; }
{
return true;
}
private: private:
// maximum number of frames the buffer can hold // maximum number of frames the buffer can hold
static constexpr size_t BUFFER_SIZE_MAX = 8192; static constexpr size_t BUFFER_SIZE_MAX = 8192;
@ -60,7 +56,7 @@ private:
std::condition_variable cv; std::condition_variable cv;
std::mutex cv_m; std::mutex cv_m;
snd_pcm_t *handle; snd_pcm_t* handle;
unsigned int frames_to_deliver; unsigned int frames_to_deliver;
#endif #endif
}; };

View File

@ -2,22 +2,21 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "AudioCommon/AlsaSoundStream.h"
#include "AudioCommon/AOSoundStream.h"
#include "AudioCommon/AudioCommon.h" #include "AudioCommon/AudioCommon.h"
#include "AudioCommon/AOSoundStream.h"
#include "AudioCommon/AlsaSoundStream.h"
#include "AudioCommon/CoreAudioSoundStream.h" #include "AudioCommon/CoreAudioSoundStream.h"
#include "AudioCommon/Mixer.h" #include "AudioCommon/Mixer.h"
#include "AudioCommon/NullSoundStream.h" #include "AudioCommon/NullSoundStream.h"
#include "AudioCommon/OpenALStream.h" #include "AudioCommon/OpenALStream.h"
#include "AudioCommon/OpenSLESStream.h" #include "AudioCommon/OpenSLESStream.h"
#include "AudioCommon/PulseAudioStream.h" #include "AudioCommon/PulseAudioStream.h"
#include "AudioCommon/XAudio2_7Stream.h"
#include "AudioCommon/XAudio2Stream.h" #include "AudioCommon/XAudio2Stream.h"
#include "AudioCommon/XAudio2_7Stream.h"
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
#include "Common/MsgHandler.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#include "Core/Movie.h" #include "Core/Movie.h"
@ -28,11 +27,11 @@ static bool s_audio_dump_start = false;
namespace AudioCommon namespace AudioCommon
{ {
static const int AUDIO_VOLUME_MIN = 0; static const int AUDIO_VOLUME_MIN = 0;
static const int AUDIO_VOLUME_MAX = 100; static const int AUDIO_VOLUME_MAX = 100;
SoundStream* InitSoundStream() SoundStream* InitSoundStream()
{ {
std::string backend = SConfig::GetInstance().sBackend; std::string backend = SConfig::GetInstance().sBackend;
if (backend == BACKEND_OPENAL && OpenALStream::isValid()) if (backend == BACKEND_OPENAL && OpenALStream::isValid())
g_sound_stream = new OpenALStream(); g_sound_stream = new OpenALStream();
@ -58,8 +57,8 @@ namespace AudioCommon
if (!g_sound_stream && NullSound::isValid()) if (!g_sound_stream && NullSound::isValid())
{ {
WARN_LOG(AUDIO, "Could not initialize backend %s, using %s instead.", WARN_LOG(AUDIO, "Could not initialize backend %s, using %s instead.", backend.c_str(),
backend.c_str(), BACKEND_NULLSOUND); BACKEND_NULLSOUND);
g_sound_stream = new NullSound(); g_sound_stream = new NullSound();
} }
@ -68,8 +67,8 @@ namespace AudioCommon
UpdateSoundStream(); UpdateSoundStream();
if (!g_sound_stream->Start()) if (!g_sound_stream->Start())
{ {
ERROR_LOG(AUDIO, "Could not start backend %s, using %s instead", ERROR_LOG(AUDIO, "Could not start backend %s, using %s instead", backend.c_str(),
backend.c_str(), BACKEND_NULLSOUND); BACKEND_NULLSOUND);
delete g_sound_stream; delete g_sound_stream;
g_sound_stream = new NullSound(); g_sound_stream = new NullSound();
g_sound_stream->Start(); g_sound_stream->Start();
@ -86,10 +85,10 @@ namespace AudioCommon
delete g_sound_stream; delete g_sound_stream;
g_sound_stream = nullptr; g_sound_stream = nullptr;
return nullptr; return nullptr;
} }
void ShutdownSoundStream() void ShutdownSoundStream()
{ {
INFO_LOG(AUDIO, "Shutting down sound stream"); INFO_LOG(AUDIO, "Shutting down sound stream");
if (g_sound_stream) if (g_sound_stream)
@ -102,10 +101,10 @@ namespace AudioCommon
} }
INFO_LOG(AUDIO, "Done shutting down sound stream"); INFO_LOG(AUDIO, "Done shutting down sound stream");
} }
std::vector<std::string> GetSoundBackends() std::vector<std::string> GetSoundBackends()
{ {
std::vector<std::string> backends; std::vector<std::string> backends;
if (NullSound::isValid()) if (NullSound::isValid())
@ -125,25 +124,25 @@ namespace AudioCommon
if (OpenSLESStream::isValid()) if (OpenSLESStream::isValid())
backends.push_back(BACKEND_OPENSLES); backends.push_back(BACKEND_OPENSLES);
return backends; return backends;
} }
void UpdateSoundStream() void UpdateSoundStream()
{ {
if (g_sound_stream) if (g_sound_stream)
{ {
int volume = SConfig::GetInstance().m_IsMuted ? 0 : SConfig::GetInstance().m_Volume; int volume = SConfig::GetInstance().m_IsMuted ? 0 : SConfig::GetInstance().m_Volume;
g_sound_stream->SetVolume(volume); g_sound_stream->SetVolume(volume);
} }
} }
void ClearAudioBuffer(bool mute) void ClearAudioBuffer(bool mute)
{ {
if (g_sound_stream) if (g_sound_stream)
g_sound_stream->Clear(mute); g_sound_stream->Clear(mute);
} }
void SendAIBuffer(short *samples, unsigned int num_samples) void SendAIBuffer(short* samples, unsigned int num_samples)
{ {
if (!g_sound_stream) if (!g_sound_stream)
return; return;
@ -160,10 +159,10 @@ namespace AudioCommon
} }
g_sound_stream->Update(); g_sound_stream->Update();
} }
void StartAudioDump() void StartAudioDump()
{ {
std::string audio_file_name_dtk = File::GetUserPath(D_DUMPAUDIO_IDX) + "dtkdump.wav"; std::string audio_file_name_dtk = File::GetUserPath(D_DUMPAUDIO_IDX) + "dtkdump.wav";
std::string audio_file_name_dsp = File::GetUserPath(D_DUMPAUDIO_IDX) + "dspdump.wav"; std::string audio_file_name_dsp = File::GetUserPath(D_DUMPAUDIO_IDX) + "dspdump.wav";
File::CreateFullPath(audio_file_name_dtk); File::CreateFullPath(audio_file_name_dtk);
@ -171,39 +170,39 @@ namespace AudioCommon
g_sound_stream->GetMixer()->StartLogDTKAudio(audio_file_name_dtk); g_sound_stream->GetMixer()->StartLogDTKAudio(audio_file_name_dtk);
g_sound_stream->GetMixer()->StartLogDSPAudio(audio_file_name_dsp); g_sound_stream->GetMixer()->StartLogDSPAudio(audio_file_name_dsp);
s_audio_dump_start = true; s_audio_dump_start = true;
} }
void StopAudioDump() void StopAudioDump()
{ {
g_sound_stream->GetMixer()->StopLogDTKAudio(); g_sound_stream->GetMixer()->StopLogDTKAudio();
g_sound_stream->GetMixer()->StopLogDSPAudio(); g_sound_stream->GetMixer()->StopLogDSPAudio();
s_audio_dump_start = false; s_audio_dump_start = false;
} }
void IncreaseVolume(unsigned short offset) void IncreaseVolume(unsigned short offset)
{ {
SConfig::GetInstance().m_IsMuted = false; SConfig::GetInstance().m_IsMuted = false;
int& currentVolume = SConfig::GetInstance().m_Volume; int& currentVolume = SConfig::GetInstance().m_Volume;
currentVolume += offset; currentVolume += offset;
if (currentVolume > AUDIO_VOLUME_MAX) if (currentVolume > AUDIO_VOLUME_MAX)
currentVolume = AUDIO_VOLUME_MAX; currentVolume = AUDIO_VOLUME_MAX;
UpdateSoundStream(); UpdateSoundStream();
} }
void DecreaseVolume(unsigned short offset) void DecreaseVolume(unsigned short offset)
{ {
SConfig::GetInstance().m_IsMuted = false; SConfig::GetInstance().m_IsMuted = false;
int& currentVolume = SConfig::GetInstance().m_Volume; int& currentVolume = SConfig::GetInstance().m_Volume;
currentVolume -= offset; currentVolume -= offset;
if (currentVolume < AUDIO_VOLUME_MIN) if (currentVolume < AUDIO_VOLUME_MIN)
currentVolume = AUDIO_VOLUME_MIN; currentVolume = AUDIO_VOLUME_MIN;
UpdateSoundStream(); UpdateSoundStream();
} }
void ToggleMuteVolume() void ToggleMuteVolume()
{ {
bool& isMuted = SConfig::GetInstance().m_IsMuted; bool& isMuted = SConfig::GetInstance().m_IsMuted;
isMuted = !isMuted; isMuted = !isMuted;
UpdateSoundStream(); UpdateSoundStream();
} }
} }

View File

@ -7,22 +7,21 @@
#include "AudioCommon/SoundStream.h" #include "AudioCommon/SoundStream.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
class CMixer; class CMixer;
extern SoundStream *g_sound_stream; extern SoundStream* g_sound_stream;
namespace AudioCommon namespace AudioCommon
{ {
SoundStream* InitSoundStream(); SoundStream* InitSoundStream();
void ShutdownSoundStream(); void ShutdownSoundStream();
std::vector<std::string> GetSoundBackends(); std::vector<std::string> GetSoundBackends();
void UpdateSoundStream(); void UpdateSoundStream();
void ClearAudioBuffer(bool mute); void ClearAudioBuffer(bool mute);
void SendAIBuffer(short* samples, unsigned int num_samples); void SendAIBuffer(short* samples, unsigned int num_samples);
void StartAudioDump(); void StartAudioDump();
void StopAudioDump(); void StopAudioDump();
void IncreaseVolume(unsigned short offset); void IncreaseVolume(unsigned short offset);
void DecreaseVolume(unsigned short offset); void DecreaseVolume(unsigned short offset);
void ToggleMuteVolume(); void ToggleMuteVolume();
} }

View File

@ -7,15 +7,13 @@
#include "AudioCommon/CoreAudioSoundStream.h" #include "AudioCommon/CoreAudioSoundStream.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
OSStatus CoreAudioSound::callback(void *inRefCon, OSStatus CoreAudioSound::callback(void* inRefCon, AudioUnitRenderActionFlags* ioActionFlags,
AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp* inTimeStamp, UInt32 inBusNumber,
const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList* ioData)
UInt32 inNumberFrames, AudioBufferList *ioData)
{ {
for (UInt32 i = 0; i < ioData->mNumberBuffers; i++) for (UInt32 i = 0; i < ioData->mNumberBuffers; i++)
((CoreAudioSound *)inRefCon)->m_mixer-> ((CoreAudioSound*)inRefCon)
Mix((short *)ioData->mBuffers[i].mData, ->m_mixer->Mix((short*)ioData->mBuffers[i].mData, ioData->mBuffers[i].mDataByteSize / 4);
ioData->mBuffers[i].mDataByteSize / 4);
return noErr; return noErr;
} }
@ -47,12 +45,9 @@ bool CoreAudioSound::Start()
return false; return false;
} }
FillOutASBDForLPCM(format, m_mixer->GetSampleRate(), FillOutASBDForLPCM(format, m_mixer->GetSampleRate(), 2, 16, 16, false, false, false);
2, 16, 16, false, false, false); err = AudioUnitSetProperty(audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0,
err = AudioUnitSetProperty(audioUnit, &format, sizeof(AudioStreamBasicDescription));
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input, 0, &format,
sizeof(AudioStreamBasicDescription));
if (err != noErr) if (err != noErr)
{ {
ERROR_LOG(AUDIO, "error setting audio format"); ERROR_LOG(AUDIO, "error setting audio format");
@ -61,19 +56,15 @@ bool CoreAudioSound::Start()
callback_struct.inputProc = callback; callback_struct.inputProc = callback;
callback_struct.inputProcRefCon = this; callback_struct.inputProcRefCon = this;
err = AudioUnitSetProperty(audioUnit, err = AudioUnitSetProperty(audioUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input,
kAudioUnitProperty_SetRenderCallback, 0, &callback_struct, sizeof callback_struct);
kAudioUnitScope_Input, 0, &callback_struct,
sizeof callback_struct);
if (err != noErr) if (err != noErr)
{ {
ERROR_LOG(AUDIO, "error setting audio callback"); ERROR_LOG(AUDIO, "error setting audio callback");
return false; return false;
} }
err = AudioUnitSetParameter(audioUnit, err = AudioUnitSetParameter(audioUnit, kHALOutputParam_Volume, kAudioUnitScope_Output, 0,
kHALOutputParam_Volume,
kAudioUnitScope_Output, 0,
m_volume / 100., 0); m_volume / 100., 0);
if (err != noErr) if (err != noErr)
ERROR_LOG(AUDIO, "error setting volume"); ERROR_LOG(AUDIO, "error setting volume");
@ -100,9 +91,7 @@ void CoreAudioSound::SetVolume(int volume)
OSStatus err; OSStatus err;
m_volume = volume; m_volume = volume;
err = AudioUnitSetParameter(audioUnit, err = AudioUnitSetParameter(audioUnit, kHALOutputParam_Volume, kAudioUnitScope_Output, 0,
kHALOutputParam_Volume,
kAudioUnitScope_Output, 0,
volume / 100., 0); volume / 100., 0);
if (err != noErr) if (err != noErr)
ERROR_LOG(AUDIO, "error setting volume"); ERROR_LOG(AUDIO, "error setting volume");

View File

@ -20,19 +20,13 @@ public:
void Stop() override; void Stop() override;
void Update() override; void Update() override;
static bool isValid() static bool isValid() { return true; }
{
return true;
}
private: private:
AudioUnit audioUnit; AudioUnit audioUnit;
int m_volume; int m_volume;
static OSStatus callback(void *inRefCon, static OSStatus callback(void* inRefCon, AudioUnitRenderActionFlags* ioActionFlags,
AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp* inTimeStamp, UInt32 inBusNumber,
const AudioTimeStamp *inTimeStamp, UInt32 inNumberFrames, AudioBufferList* ioData);
UInt32 inBusNumber, UInt32 inNumberFrames,
AudioBufferList *ioData);
#endif #endif
}; };

View File

@ -35,11 +35,11 @@ static float adapt_l_gain, adapt_r_gain, adapt_lpr_gain, adapt_lmr_gain;
static std::vector<float> lf, rf, lr, rr, cf, cr; static std::vector<float> lf, rf, lr, rr, cf, cr;
static float LFE_buf[256]; static float LFE_buf[256];
static unsigned int lfe_pos; static unsigned int lfe_pos;
static float *filter_coefs_lfe; static float* filter_coefs_lfe;
static unsigned int len125; static unsigned int len125;
template<class T, class _ftype_t> template <class T, class _ftype_t>
static _ftype_t DotProduct(int count, const T *buf, const _ftype_t *coefficients) static _ftype_t DotProduct(int count, const T* buf, const _ftype_t* coefficients)
{ {
int i; int i;
float sum0 = 0.0f, sum1 = 0.0f, sum2 = 0.0f, sum3 = 0.0f; float sum0 = 0.0f, sum1 = 0.0f, sum2 = 0.0f, sum3 = 0.0f;
@ -60,15 +60,16 @@ static _ftype_t DotProduct(int count, const T *buf, const _ftype_t *coefficients
return sum0 + sum1 + sum2 + sum3; return sum0 + sum1 + sum2 + sum3;
} }
template<class T> template <class T>
static T FIRFilter(const T *buf, int pos, int len, int count, const float *coefficients) static T FIRFilter(const T* buf, int pos, int len, int count, const float* coefficients)
{ {
int count1, count2; int count1, count2;
if (pos >= count) if (pos >= count)
{ {
pos -= count; pos -= count;
count1 = count; count2 = 0; count1 = count;
count2 = 0;
} }
else else
{ {
@ -78,9 +79,10 @@ static T FIRFilter(const T *buf, int pos, int len, int count, const float *coeff
} }
// high part of window // high part of window
const T *ptr = &buf[pos]; const T* ptr = &buf[pos];
float r1 = DotProduct(count1, ptr, coefficients); coefficients += count1; float r1 = DotProduct(count1, ptr, coefficients);
coefficients += count1;
float r2 = DotProduct(count2, buf, coefficients); float r2 = DotProduct(count2, buf, coefficients);
return T(r1 + r2); return T(r1 + r2);
} }
@ -96,11 +98,11 @@ static T FIRFilter(const T *buf, int pos, int len, int count, const float *coeff
*/ */
static void Hamming(int n, float* w) static void Hamming(int n, float* w)
{ {
float k = float(2*M_PI/((float)(n - 1))); // 2*pi/(N-1) float k = float(2 * M_PI / ((float)(n - 1))); // 2*pi/(N-1)
// Calculate window coefficients // Calculate window coefficients
for (int i = 0; i < n; i++) for (int i = 0; i < n; i++)
*w++ = float(0.54 - 0.46*cos(k*(float)i)); *w++ = float(0.54 - 0.46 * cos(k * (float)i));
} }
/****************************************************************************** /******************************************************************************
@ -120,7 +122,7 @@ opt beta constant used only when designing using kaiser windows
returns 0 if OK, -1 if fail returns 0 if OK, -1 if fail
*/ */
static float* DesignFIR(unsigned int *n, float* fc, float opt) static float* DesignFIR(unsigned int* n, float* fc, float opt)
{ {
unsigned int o = *n & 1; // Indicator for odd filter length unsigned int o = *n & 1; // Indicator for odd filter length
unsigned int end = ((*n + 1) >> 1) - o; // Loop end unsigned int end = ((*n + 1) >> 1) - o; // Loop end
@ -137,7 +139,7 @@ static float* DesignFIR(unsigned int *n, float* fc, float opt)
fc[0] = MathUtil::Clamp(fc[0], 0.001f, 1.0f); fc[0] = MathUtil::Clamp(fc[0], 0.001f, 1.0f);
float *w = (float*)calloc(sizeof(float), *n); float* w = (float*)calloc(sizeof(float), *n);
// Get window coefficients // Get window coefficients
Hamming(*n, w); Hamming(*n, w);
@ -163,13 +165,12 @@ static float* DesignFIR(unsigned int *n, float* fc, float opt)
for (u32 i = 0; i < end; i++) for (u32 i = 0; i < end; i++)
{ {
t1 = (float)(i + 1) - k2; t1 = (float)(i + 1) - k2;
w[end - i - 1] = w[*n - end + i] = float(w[end - i - 1] * sin(k1 * t1)/(M_PI * t1)); // Sinc w[end - i - 1] = w[*n - end + i] = float(w[end - i - 1] * sin(k1 * t1) / (M_PI * t1)); // Sinc
g += 2*w[end - i - 1]; // Total gain in filter g += 2 * w[end - i - 1]; // Total gain in filter
} }
// Normalize gain // Normalize gain
g = 1/g; g = 1 / g;
for (u32 i = 0; i < *n; i++) for (u32 i = 0; i < *n; i++)
w[i] *= g; w[i] *= g;
@ -208,7 +209,7 @@ static float* CalculateCoefficients125HzLowpass(int rate)
{ {
len125 = 256; len125 = 256;
float f = 125.0f / (rate / 2); float f = 125.0f / (rate / 2);
float *coeffs = DesignFIR(&len125, &f, 0); float* coeffs = DesignFIR(&len125, &f, 0);
static const float M3_01DB = 0.7071067812f; static const float M3_01DB = 0.7071067812f;
for (unsigned int i = 0; i < len125; i++) for (unsigned int i = 0; i < len125; i++)
{ {
@ -219,26 +220,24 @@ static float* CalculateCoefficients125HzLowpass(int rate)
static float PassiveLock(float x) static float PassiveLock(float x)
{ {
static const float MATAGCLOCK = 0.2f; /* AGC range (around 1) where the matrix behaves passively */ static const float MATAGCLOCK =
0.2f; /* AGC range (around 1) where the matrix behaves passively */
const float x1 = x - 1; const float x1 = x - 1;
const float ax1s = fabs(x - 1) * (1.0f / MATAGCLOCK); const float ax1s = fabs(x - 1) * (1.0f / MATAGCLOCK);
return x1 - x1 / (1 + ax1s * ax1s) + 1; return x1 - x1 / (1 + ax1s * ax1s) + 1;
} }
static void MatrixDecode(const float *in, const int k, const int il, static void MatrixDecode(const float* in, const int k, const int il, const int ir, bool decode_rear,
const int ir, bool decode_rear, const int _dlbuflen, float _l_fwr, float _r_fwr, float _lpr_fwr,
const int _dlbuflen, float _lmr_fwr, float* _adapt_l_gain, float* _adapt_r_gain,
float _l_fwr, float _r_fwr, float* _adapt_lpr_gain, float* _adapt_lmr_gain, float* _lf, float* _rf,
float _lpr_fwr, float _lmr_fwr, float* _lr, float* _rr, float* _cf)
float *_adapt_l_gain, float *_adapt_r_gain,
float *_adapt_lpr_gain, float *_adapt_lmr_gain,
float *_lf, float *_rf, float *_lr,
float *_rr, float *_cf)
{ {
static const float M9_03DB = 0.3535533906f; static const float M9_03DB = 0.3535533906f;
static const float MATAGCTRIG = 8.0f; /* (Fuzzy) AGC trigger */ static const float MATAGCTRIG = 8.0f; /* (Fuzzy) AGC trigger */
static const float MATAGCDECAY = 1.0f; /* AGC baseline decay rate (1/samp.) */ static const float MATAGCDECAY = 1.0f; /* AGC baseline decay rate (1/samp.) */
static const float MATCOMPGAIN = 0.37f; /* Cross talk compensation gain, 0.50 - 0.55 is full cancellation. */ static const float MATCOMPGAIN =
0.37f; /* Cross talk compensation gain, 0.50 - 0.55 is full cancellation. */
const int kr = (k + olddelay) % _dlbuflen; const int kr = (k + olddelay) % _dlbuflen;
float l_gain = (_l_fwr + _r_fwr) / (1 + _l_fwr + _l_fwr); float l_gain = (_l_fwr + _r_fwr) / (1 + _l_fwr + _l_fwr);
@ -310,7 +309,7 @@ static void MatrixDecode(const float *in, const int k, const int il,
_cf[k] += c_agc_cfk + c_agc_cfk; _cf[k] += c_agc_cfk + c_agc_cfk;
} }
void DPL2Decode(float *samples, int numsamples, float *out) void DPL2Decode(float* samples, int numsamples, float* out)
{ {
static const unsigned int FWRDURATION = 240; // FWR average duration (samples) static const unsigned int FWRDURATION = 240; // FWR average duration (samples)
static const int cfg_delay = 0; static const int cfg_delay = 0;
@ -339,8 +338,8 @@ void DPL2Decode(float *samples, int numsamples, float *out)
memset(LFE_buf, 0, sizeof(LFE_buf)); memset(LFE_buf, 0, sizeof(LFE_buf));
} }
float *in = samples; // Input audio data float* in = samples; // Input audio data
float *end = in + numsamples * fmt_nchannels; // Loop end float* end = in + numsamples * fmt_nchannels; // Loop end
while (in < end) while (in < end)
{ {
@ -357,12 +356,9 @@ void DPL2Decode(float *samples, int numsamples, float *out)
/* Matrix encoded 2 channel sources */ /* Matrix encoded 2 channel sources */
fwrbuf_l[k] = in[0]; fwrbuf_l[k] = in[0];
fwrbuf_r[k] = in[1]; fwrbuf_r[k] = in[1];
MatrixDecode(in, k, 0, 1, true, dlbuflen, MatrixDecode(in, k, 0, 1, true, dlbuflen, l_fwr, r_fwr, lpr_fwr, lmr_fwr, &adapt_l_gain,
l_fwr, r_fwr, &adapt_r_gain, &adapt_lpr_gain, &adapt_lmr_gain, &lf[0], &rf[0], &lr[0], &rr[0],
lpr_fwr, lmr_fwr, &cf[0]);
&adapt_l_gain, &adapt_r_gain,
&adapt_lpr_gain, &adapt_lmr_gain,
&lf[0], &rf[0], &lr[0], &rr[0], &cf[0]);
out[cur + 0] = lf[k]; out[cur + 0] = lf[k];
out[cur + 1] = rf[k]; out[cur + 1] = rf[k];

View File

@ -4,5 +4,5 @@
#pragma once #pragma once
void DPL2Decode(float *samples, int numsamples, float *out); void DPL2Decode(float* samples, int numsamples, float* out);
void DPL2Reset(); void DPL2Reset();

View File

@ -8,16 +8,15 @@
#include "AudioCommon/Mixer.h" #include "AudioCommon/Mixer.h"
#include "Common/CommonFuncs.h" #include "Common/CommonFuncs.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/MathUtil.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/MathUtil.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#if _M_SSE >= 0x301 && !(defined __GNUC__ && !defined __SSSE3__) #if _M_SSE >= 0x301 && !(defined __GNUC__ && !defined __SSSE3__)
#include <tmmintrin.h> #include <tmmintrin.h>
#endif #endif
CMixer::CMixer(unsigned int BackendSampleRate) CMixer::CMixer(unsigned int BackendSampleRate) : m_sampleRate(BackendSampleRate)
: m_sampleRate(BackendSampleRate)
{ {
INFO_LOG(AUDIO_INTERFACE, "Mixer is initialized"); INFO_LOG(AUDIO_INTERFACE, "Mixer is initialized");
} }
@ -27,7 +26,8 @@ CMixer::~CMixer()
} }
// Executed from sound stream thread // Executed from sound stream thread
unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples, bool consider_framelimit) unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples,
bool consider_framelimit)
{ {
unsigned int currentSample = 0; unsigned int currentSample = 0;
@ -45,14 +45,16 @@ unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples, boo
low_waterwark = std::min(low_waterwark, MAX_SAMPLES / 2); low_waterwark = std::min(low_waterwark, MAX_SAMPLES / 2);
float numLeft = (float)(((indexW - indexR) & INDEX_MASK) / 2); float numLeft = (float)(((indexW - indexR) & INDEX_MASK) / 2);
m_numLeftI = (numLeft + m_numLeftI*(CONTROL_AVG-1)) / CONTROL_AVG; m_numLeftI = (numLeft + m_numLeftI * (CONTROL_AVG - 1)) / CONTROL_AVG;
float offset = (m_numLeftI - low_waterwark) * CONTROL_FACTOR; float offset = (m_numLeftI - low_waterwark) * CONTROL_FACTOR;
if (offset > MAX_FREQ_SHIFT) offset = MAX_FREQ_SHIFT; if (offset > MAX_FREQ_SHIFT)
if (offset < -MAX_FREQ_SHIFT) offset = -MAX_FREQ_SHIFT; offset = MAX_FREQ_SHIFT;
if (offset < -MAX_FREQ_SHIFT)
offset = -MAX_FREQ_SHIFT;
//render numleft sample pairs to samples[] // render numleft sample pairs to samples[]
//advance indexR with sample position // advance indexR with sample position
//remember fractional offset // remember fractional offset
float emulationspeed = SConfig::GetInstance().m_EmulationSpeed; float emulationspeed = SConfig::GetInstance().m_EmulationSpeed;
float aid_sample_rate = m_input_sample_rate + offset; float aid_sample_rate = m_input_sample_rate + offset;
@ -67,19 +69,19 @@ unsigned int CMixer::MixerFifo::Mix(short* samples, unsigned int numSamples, boo
s32 rvolume = m_RVolume.load(); s32 rvolume = m_RVolume.load();
// TODO: consider a higher-quality resampling algorithm. // TODO: consider a higher-quality resampling algorithm.
for (; currentSample < numSamples * 2 && ((indexW-indexR) & INDEX_MASK) > 2; currentSample += 2) for (; currentSample < numSamples * 2 && ((indexW - indexR) & INDEX_MASK) > 2; currentSample += 2)
{ {
u32 indexR2 = indexR + 2; //next sample u32 indexR2 = indexR + 2; // next sample
s16 l1 = Common::swap16(m_buffer[indexR & INDEX_MASK]); //current s16 l1 = Common::swap16(m_buffer[indexR & INDEX_MASK]); // current
s16 l2 = Common::swap16(m_buffer[indexR2 & INDEX_MASK]); //next s16 l2 = Common::swap16(m_buffer[indexR2 & INDEX_MASK]); // next
int sampleL = ((l1 << 16) + (l2 - l1) * (u16)m_frac) >> 16; int sampleL = ((l1 << 16) + (l2 - l1) * (u16)m_frac) >> 16;
sampleL = (sampleL * lvolume) >> 8; sampleL = (sampleL * lvolume) >> 8;
sampleL += samples[currentSample + 1]; sampleL += samples[currentSample + 1];
samples[currentSample + 1] = MathUtil::Clamp(sampleL, -32767, 32767); samples[currentSample + 1] = MathUtil::Clamp(sampleL, -32767, 32767);
s16 r1 = Common::swap16(m_buffer[(indexR + 1) & INDEX_MASK]); //current s16 r1 = Common::swap16(m_buffer[(indexR + 1) & INDEX_MASK]); // current
s16 r2 = Common::swap16(m_buffer[(indexR2 + 1) & INDEX_MASK]); //next s16 r2 = Common::swap16(m_buffer[(indexR2 + 1) & INDEX_MASK]); // next
int sampleR = ((r1 << 16) + (r2 - r1) * (u16)m_frac) >> 16; int sampleR = ((r1 << 16) + (r2 - r1) * (u16)m_frac) >> 16;
sampleR = (sampleR * rvolume) >> 8; sampleR = (sampleR * rvolume) >> 8;
sampleR += samples[currentSample]; sampleR += samples[currentSample];
@ -124,7 +126,7 @@ unsigned int CMixer::Mix(short* samples, unsigned int num_samples, bool consider
return num_samples; return num_samples;
} }
void CMixer::MixerFifo::PushSamples(const short *samples, unsigned int num_samples) void CMixer::MixerFifo::PushSamples(const short* samples, unsigned int num_samples)
{ {
// Cache access in non-volatile variable // Cache access in non-volatile variable
// indexR isn't allowed to cache in the audio throttling loop as it // indexR isn't allowed to cache in the audio throttling loop as it
@ -153,21 +155,22 @@ void CMixer::MixerFifo::PushSamples(const short *samples, unsigned int num_sampl
m_indexW.fetch_add(num_samples * 2); m_indexW.fetch_add(num_samples * 2);
} }
void CMixer::PushSamples(const short *samples, unsigned int num_samples) void CMixer::PushSamples(const short* samples, unsigned int num_samples)
{ {
m_dma_mixer.PushSamples(samples, num_samples); m_dma_mixer.PushSamples(samples, num_samples);
if (m_log_dsp_audio) if (m_log_dsp_audio)
m_wave_writer_dsp.AddStereoSamplesBE(samples, num_samples); m_wave_writer_dsp.AddStereoSamplesBE(samples, num_samples);
} }
void CMixer::PushStreamingSamples(const short *samples, unsigned int num_samples) void CMixer::PushStreamingSamples(const short* samples, unsigned int num_samples)
{ {
m_streaming_mixer.PushSamples(samples, num_samples); m_streaming_mixer.PushSamples(samples, num_samples);
if (m_log_dtk_audio) if (m_log_dtk_audio)
m_wave_writer_dtk.AddStereoSamplesBE(samples, num_samples); m_wave_writer_dtk.AddStereoSamplesBE(samples, num_samples);
} }
void CMixer::PushWiimoteSpeakerSamples(const short *samples, unsigned int num_samples, unsigned int sample_rate) void CMixer::PushWiimoteSpeakerSamples(const short* samples, unsigned int num_samples,
unsigned int sample_rate)
{ {
short samples_stereo[MAX_SAMPLES * 2]; short samples_stereo[MAX_SAMPLES * 2];

View File

@ -22,9 +22,9 @@ public:
// Called from main thread // Called from main thread
void PushSamples(const short* samples, unsigned int num_samples); void PushSamples(const short* samples, unsigned int num_samples);
void PushStreamingSamples(const short* samples, unsigned int num_samples); void PushStreamingSamples(const short* samples, unsigned int num_samples);
void PushWiimoteSpeakerSamples(const short* samples, unsigned int num_samples, unsigned int sample_rate); void PushWiimoteSpeakerSamples(const short* samples, unsigned int num_samples,
unsigned int sample_rate);
unsigned int GetSampleRate() const { return m_sampleRate; } unsigned int GetSampleRate() const { return m_sampleRate; }
void SetDMAInputSampleRate(unsigned int rate); void SetDMAInputSampleRate(unsigned int rate);
void SetStreamInputSampleRate(unsigned int rate); void SetStreamInputSampleRate(unsigned int rate);
void SetStreamingVolume(unsigned int lvolume, unsigned int rvolume); void SetStreamingVolume(unsigned int lvolume, unsigned int rvolume);
@ -38,7 +38,6 @@ public:
float GetCurrentSpeed() const { return m_speed.load(); } float GetCurrentSpeed() const { return m_speed.load(); }
void UpdateSpeed(float val) { m_speed.store(val); } void UpdateSpeed(float val) { m_speed.store(val); }
private: private:
static constexpr u32 MAX_SAMPLES = 1024 * 4; // 128 ms static constexpr u32 MAX_SAMPLES = 1024 * 4; // 128 ms
static constexpr u32 INDEX_MASK = MAX_SAMPLES * 2 - 1; static constexpr u32 INDEX_MASK = MAX_SAMPLES * 2 - 1;
@ -50,14 +49,14 @@ private:
{ {
public: public:
MixerFifo(CMixer* mixer, unsigned sample_rate) MixerFifo(CMixer* mixer, unsigned sample_rate)
: m_mixer(mixer) : m_mixer(mixer), m_input_sample_rate(sample_rate)
, m_input_sample_rate(sample_rate)
{ {
} }
void PushSamples(const short* samples, unsigned int num_samples); void PushSamples(const short* samples, unsigned int num_samples);
unsigned int Mix(short* samples, unsigned int numSamples, bool consider_framelimit = true); unsigned int Mix(short* samples, unsigned int numSamples, bool consider_framelimit = true);
void SetInputSampleRate(unsigned int rate); void SetInputSampleRate(unsigned int rate);
void SetVolume(unsigned int lvolume, unsigned int rvolume); void SetVolume(unsigned int lvolume, unsigned int rvolume);
private: private:
CMixer* m_mixer; CMixer* m_mixer;
unsigned m_input_sample_rate; unsigned m_input_sample_rate;

View File

@ -25,9 +25,12 @@ void NullSound::Update()
// num_samples_to_render in this update - depends on SystemTimers::AUDIO_DMA_PERIOD. // num_samples_to_render in this update - depends on SystemTimers::AUDIO_DMA_PERIOD.
constexpr u32 stereo_16_bit_size = 4; constexpr u32 stereo_16_bit_size = 4;
constexpr u32 dma_length = 32; constexpr u32 dma_length = 32;
const u64 audio_dma_period = SystemTimers::GetTicksPerSecond() / (AudioInterface::GetAIDSampleRate() * stereo_16_bit_size / dma_length); const u64 audio_dma_period =
SystemTimers::GetTicksPerSecond() /
(AudioInterface::GetAIDSampleRate() * stereo_16_bit_size / dma_length);
const u64 ais_samples_per_second = 48000 * stereo_16_bit_size; const u64 ais_samples_per_second = 48000 * stereo_16_bit_size;
const u64 num_samples_to_render = (audio_dma_period * ais_samples_per_second) / SystemTimers::GetTicksPerSecond(); const u64 num_samples_to_render =
(audio_dma_period * ais_samples_per_second) / SystemTimers::GetTicksPerSecond();
m_mixer->Mix(m_realtime_buffer.data(), (unsigned int)num_samples_to_render); m_mixer->Mix(m_realtime_buffer.data(), (unsigned int)num_samples_to_render);
} }

View File

@ -18,7 +18,6 @@ public:
void Update() override; void Update() override;
static bool isValid() { return true; } static bool isValid() { return true; }
private: private:
static constexpr size_t BUFFER_SIZE = 48000 * 4 / 32; static constexpr size_t BUFFER_SIZE = 48000 * 4 / 32;

View File

@ -5,11 +5,11 @@
#include <cstring> #include <cstring>
#include <thread> #include <thread>
#include "AudioCommon/aldlist.h"
#include "AudioCommon/DPL2Decoder.h" #include "AudioCommon/DPL2Decoder.h"
#include "AudioCommon/OpenALStream.h" #include "AudioCommon/OpenALStream.h"
#include "Common/Thread.h" #include "AudioCommon/aldlist.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/Thread.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
#if defined HAVE_OPENAL && HAVE_OPENAL #if defined HAVE_OPENAL && HAVE_OPENAL
@ -31,20 +31,20 @@ bool OpenALStream::Start()
ALDeviceList pDeviceList; ALDeviceList pDeviceList;
if (pDeviceList.GetNumDevices()) if (pDeviceList.GetNumDevices())
{ {
char *defDevName = pDeviceList.GetDeviceName(pDeviceList.GetDefaultDevice()); char* defDevName = pDeviceList.GetDeviceName(pDeviceList.GetDefaultDevice());
WARN_LOG(AUDIO, "Found OpenAL device %s", defDevName); WARN_LOG(AUDIO, "Found OpenAL device %s", defDevName);
ALCdevice *pDevice = alcOpenDevice(defDevName); ALCdevice* pDevice = alcOpenDevice(defDevName);
if (pDevice) if (pDevice)
{ {
ALCcontext *pContext = alcCreateContext(pDevice, nullptr); ALCcontext* pContext = alcCreateContext(pDevice, nullptr);
if (pContext) if (pContext)
{ {
// Used to determine an appropriate period size (2x period = total buffer size) // Used to determine an appropriate period size (2x period = total buffer size)
//ALCint refresh; // ALCint refresh;
//alcGetIntegerv(pDevice, ALC_REFRESH, 1, &refresh); // alcGetIntegerv(pDevice, ALC_REFRESH, 1, &refresh);
//period_size_in_millisec = 1000 / refresh; // period_size_in_millisec = 1000 / refresh;
alcMakeContextCurrent(pContext); alcMakeContextCurrent(pContext);
thread = std::thread(&OpenALStream::SoundLoop, this); thread = std::thread(&OpenALStream::SoundLoop, this);
@ -91,8 +91,8 @@ void OpenALStream::Stop()
uiSource = 0; uiSource = 0;
alDeleteBuffers(numBuffers, uiBuffers); alDeleteBuffers(numBuffers, uiBuffers);
ALCcontext *pContext = alcGetCurrentContext(); ALCcontext* pContext = alcGetCurrentContext();
ALCdevice *pDevice = alcGetContextsDevice(pContext); ALCdevice* pDevice = alcGetContextsDevice(pContext);
alcMakeContextCurrent(nullptr); alcMakeContextCurrent(nullptr);
alcDestroyContext(pContext); alcDestroyContext(pContext);
@ -149,12 +149,13 @@ void OpenALStream::SoundLoop()
memset(uiBuffers, 0, numBuffers * sizeof(ALuint)); memset(uiBuffers, 0, numBuffers * sizeof(ALuint));
uiSource = 0; uiSource = 0;
// Checks if a X-Fi is being used. If it is, disable FLOAT32 support as this sound card has no support for it even though it reports it does. // Checks if a X-Fi is being used. If it is, disable FLOAT32 support as this sound card has no
// support for it even though it reports it does.
if (strstr(alGetString(AL_RENDERER), "X-Fi")) if (strstr(alGetString(AL_RENDERER), "X-Fi"))
float32_capable = false; float32_capable = false;
// Generate some AL Buffers for streaming // Generate some AL Buffers for streaming
alGenBuffers(numBuffers, (ALuint *)uiBuffers); alGenBuffers(numBuffers, (ALuint*)uiBuffers);
// Generate a Source to playback the Buffers // Generate a Source to playback the Buffers
alGenSources(1, &uiSource); alGenSources(1, &uiSource);
@ -171,13 +172,16 @@ void OpenALStream::SoundLoop()
if (surround_capable) if (surround_capable)
{ {
if (float32_capable) if (float32_capable)
alBufferData(uiBuffers[i], AL_FORMAT_51CHN32, sampleBuffer, 4 * FRAME_SURROUND_FLOAT, ulFrequency); alBufferData(uiBuffers[i], AL_FORMAT_51CHN32, sampleBuffer, 4 * FRAME_SURROUND_FLOAT,
ulFrequency);
else else
alBufferData(uiBuffers[i], AL_FORMAT_51CHN16, sampleBuffer, 4 * FRAME_SURROUND_SHORT, ulFrequency); alBufferData(uiBuffers[i], AL_FORMAT_51CHN16, sampleBuffer, 4 * FRAME_SURROUND_SHORT,
ulFrequency);
} }
else else
{ {
alBufferData(uiBuffers[i], AL_FORMAT_STEREO16, realtimeBuffer, 4 * FRAME_STEREO_SHORT, ulFrequency); alBufferData(uiBuffers[i], AL_FORMAT_STEREO16, realtimeBuffer, 4 * FRAME_STEREO_SHORT,
ulFrequency);
} }
} }
alSourceQueueBuffers(uiSource, numBuffers, uiBuffers); alSourceQueueBuffers(uiSource, numBuffers, uiBuffers);
@ -187,12 +191,12 @@ void OpenALStream::SoundLoop()
alSourcef(uiSource, AL_GAIN, fVolume); alSourcef(uiSource, AL_GAIN, fVolume);
// TODO: Error handling // TODO: Error handling
//ALenum err = alGetError(); // ALenum err = alGetError();
ALint iBuffersFilled = 0; ALint iBuffersFilled = 0;
ALint iBuffersProcessed = 0; ALint iBuffersProcessed = 0;
ALint iState = 0; ALint iState = 0;
ALuint uiBufferTemp[OAL_MAX_BUFFERS] = { 0 }; ALuint uiBufferTemp[OAL_MAX_BUFFERS] = {0};
soundTouch.setChannels(2); soundTouch.setChannels(2);
soundTouch.setSampleRate(ulFrequency); soundTouch.setSampleRate(ulFrequency);
@ -209,11 +213,14 @@ void OpenALStream::SoundLoop()
const u32 stereo_16_bit_size = 4; const u32 stereo_16_bit_size = 4;
const u32 dma_length = 32; const u32 dma_length = 32;
const u64 ais_samples_per_second = 48000 * stereo_16_bit_size; const u64 ais_samples_per_second = 48000 * stereo_16_bit_size;
u64 audio_dma_period = SystemTimers::GetTicksPerSecond() / (AudioInterface::GetAIDSampleRate() * stereo_16_bit_size / dma_length); u64 audio_dma_period = SystemTimers::GetTicksPerSecond() /
u64 num_samples_to_render = (audio_dma_period * ais_samples_per_second) / SystemTimers::GetTicksPerSecond(); (AudioInterface::GetAIDSampleRate() * stereo_16_bit_size / dma_length);
u64 num_samples_to_render =
(audio_dma_period * ais_samples_per_second) / SystemTimers::GetTicksPerSecond();
unsigned int numSamples = (unsigned int)num_samples_to_render; unsigned int numSamples = (unsigned int)num_samples_to_render;
unsigned int minSamples = surround_capable ? 240 : 0; // DPL2 accepts 240 samples minimum (FWRDURATION) unsigned int minSamples =
surround_capable ? 240 : 0; // DPL2 accepts 240 samples minimum (FWRDURATION)
numSamples = (numSamples > OAL_MAX_SAMPLES) ? OAL_MAX_SAMPLES : numSamples; numSamples = (numSamples > OAL_MAX_SAMPLES) ? OAL_MAX_SAMPLES : numSamples;
numSamples = m_mixer->Mix(realtimeBuffer, numSamples, false); numSamples = m_mixer->Mix(realtimeBuffer, numSamples, false);
@ -256,7 +263,8 @@ void OpenALStream::SoundLoop()
if (nSamples <= minSamples) if (nSamples <= minSamples)
continue; continue;
// Remove the Buffer from the Queue. (uiBuffer contains the Buffer ID for the unqueued Buffer) // Remove the Buffer from the Queue. (uiBuffer contains the Buffer ID for the unqueued
// Buffer)
if (iBuffersFilled == 0) if (iBuffersFilled == 0)
{ {
alSourceUnqueueBuffers(uiSource, iBuffersProcessed, uiBufferTemp); alSourceUnqueueBuffers(uiSource, iBuffersProcessed, uiBufferTemp);
@ -278,12 +286,13 @@ void OpenALStream::SoundLoop()
// DPL2Decode output: LEFTFRONT, RIGHTFRONT, CENTREFRONT, (sub), LEFTREAR, RIGHTREAR // DPL2Decode output: LEFTFRONT, RIGHTFRONT, CENTREFRONT, (sub), LEFTREAR, RIGHTREAR
for (u32 i = 0; i < nSamples; ++i) for (u32 i = 0; i < nSamples; ++i)
{ {
dpl2[i*SURROUND_CHANNELS + 3 /*sub/lfe*/] = 0.0f; dpl2[i * SURROUND_CHANNELS + 3 /*sub/lfe*/] = 0.0f;
} }
if (float32_capable) if (float32_capable)
{ {
alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_51CHN32, dpl2, nSamples * FRAME_SURROUND_FLOAT, ulFrequency); alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_51CHN32, dpl2,
nSamples * FRAME_SURROUND_FLOAT, ulFrequency);
} }
else else
{ {
@ -291,14 +300,16 @@ void OpenALStream::SoundLoop()
for (u32 i = 0; i < nSamples * SURROUND_CHANNELS; ++i) for (u32 i = 0; i < nSamples * SURROUND_CHANNELS; ++i)
surround_short[i] = (short)((float)dpl2[i] * (1 << 15)); surround_short[i] = (short)((float)dpl2[i] * (1 << 15));
alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_51CHN16, surround_short, nSamples * FRAME_SURROUND_SHORT, ulFrequency); alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_51CHN16, surround_short,
nSamples * FRAME_SURROUND_SHORT, ulFrequency);
} }
ALenum err = alGetError(); ALenum err = alGetError();
if (err == AL_INVALID_ENUM) if (err == AL_INVALID_ENUM)
{ {
// 5.1 is not supported by the host, fallback to stereo // 5.1 is not supported by the host, fallback to stereo
WARN_LOG(AUDIO, "Unable to set 5.1 surround mode. Updating OpenAL Soft might fix this issue."); WARN_LOG(AUDIO,
"Unable to set 5.1 surround mode. Updating OpenAL Soft might fix this issue.");
surround_capable = false; surround_capable = false;
} }
else if (err != 0) else if (err != 0)
@ -311,7 +322,8 @@ void OpenALStream::SoundLoop()
{ {
if (float32_capable) if (float32_capable)
{ {
alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_STEREO_FLOAT32, sampleBuffer, nSamples * FRAME_STEREO_FLOAT, ulFrequency); alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_STEREO_FLOAT32, sampleBuffer,
nSamples * FRAME_STEREO_FLOAT, ulFrequency);
ALenum err = alGetError(); ALenum err = alGetError();
if (err == AL_INVALID_ENUM) if (err == AL_INVALID_ENUM)
{ {
@ -330,7 +342,8 @@ void OpenALStream::SoundLoop()
for (u32 i = 0; i < nSamples * STEREO_CHANNELS; ++i) for (u32 i = 0; i < nSamples * STEREO_CHANNELS; ++i)
stereo[i] = (short)((float)sampleBuffer[i] * (1 << 15)); stereo[i] = (short)((float)sampleBuffer[i] * (1 << 15));
alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_STEREO16, stereo, nSamples * FRAME_STEREO_SHORT, ulFrequency); alBufferData(uiBufferTemp[iBuffersFilled], AL_FORMAT_STEREO16, stereo,
nSamples * FRAME_STEREO_SHORT, ulFrequency);
} }
} }
@ -371,5 +384,4 @@ void OpenALStream::SoundLoop()
} }
} }
#endif //HAVE_OPENAL #endif // HAVE_OPENAL

View File

@ -32,8 +32,8 @@
#define BOOL SoundTouch_BOOL #define BOOL SoundTouch_BOOL
#endif #endif
#include <soundtouch/SoundTouch.h>
#include <soundtouch/STTypes.h> #include <soundtouch/STTypes.h>
#include <soundtouch/SoundTouch.h>
#ifdef __APPLE__ #ifdef __APPLE__
#undef BOOL #undef BOOL
@ -47,20 +47,17 @@
#define SURROUND_CHANNELS 6 // number of channels in surround mode #define SURROUND_CHANNELS 6 // number of channels in surround mode
#define SIZE_SHORT 2 #define SIZE_SHORT 2
#define SIZE_FLOAT 4 // size of a float in bytes #define SIZE_FLOAT 4 // size of a float in bytes
#define FRAME_STEREO_SHORT STEREO_CHANNELS * SIZE_SHORT #define FRAME_STEREO_SHORT STEREO_CHANNELS* SIZE_SHORT
#define FRAME_STEREO_FLOAT STEREO_CHANNELS * SIZE_FLOAT #define FRAME_STEREO_FLOAT STEREO_CHANNELS* SIZE_FLOAT
#define FRAME_SURROUND_FLOAT SURROUND_CHANNELS * SIZE_FLOAT #define FRAME_SURROUND_FLOAT SURROUND_CHANNELS* SIZE_FLOAT
#define FRAME_SURROUND_SHORT SURROUND_CHANNELS * SIZE_SHORT #define FRAME_SURROUND_SHORT SURROUND_CHANNELS* SIZE_SHORT
#endif #endif
class OpenALStream final : public SoundStream class OpenALStream final : public SoundStream
{ {
#if defined HAVE_OPENAL && HAVE_OPENAL #if defined HAVE_OPENAL && HAVE_OPENAL
public: public:
OpenALStream() : uiSource(0) OpenALStream() : uiSource(0) {}
{
}
bool Start() override; bool Start() override;
void SoundLoop() override; void SoundLoop() override;
void SetVolume(int volume) override; void SetVolume(int volume) override;
@ -69,7 +66,6 @@ public:
void Update() override; void Update() override;
static bool isValid() { return true; } static bool isValid() { return true; }
private: private:
std::thread thread; std::thread thread;
std::atomic<bool> m_run_thread; std::atomic<bool> m_run_thread;

View File

@ -24,7 +24,7 @@ static SLPlayItf bqPlayerPlay;
static SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue; static SLAndroidSimpleBufferQueueItf bqPlayerBufferQueue;
static SLMuteSoloItf bqPlayerMuteSolo; static SLMuteSoloItf bqPlayerMuteSolo;
static SLVolumeItf bqPlayerVolume; static SLVolumeItf bqPlayerVolume;
static CMixer *g_mixer; static CMixer* g_mixer;
#define BUFFER_SIZE 512 #define BUFFER_SIZE 512
#define BUFFER_SIZE_IN_SAMPLES (BUFFER_SIZE / 2) #define BUFFER_SIZE_IN_SAMPLES (BUFFER_SIZE / 2)
@ -32,14 +32,15 @@ static CMixer *g_mixer;
static short buffer[2][BUFFER_SIZE]; static short buffer[2][BUFFER_SIZE];
static int curBuffer = 0; static int curBuffer = 0;
static void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void *context) static void bqPlayerCallback(SLAndroidSimpleBufferQueueItf bq, void* context)
{ {
assert(bq == bqPlayerBufferQueue); assert(bq == bqPlayerBufferQueue);
assert(nullptr == context); assert(nullptr == context);
// Render to the fresh buffer // Render to the fresh buffer
g_mixer->Mix(reinterpret_cast<short *>(buffer[curBuffer]), BUFFER_SIZE_IN_SAMPLES); g_mixer->Mix(reinterpret_cast<short*>(buffer[curBuffer]), BUFFER_SIZE_IN_SAMPLES);
SLresult result = (*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, buffer[curBuffer], sizeof(buffer[0])); SLresult result =
(*bqPlayerBufferQueue)->Enqueue(bqPlayerBufferQueue, buffer[curBuffer], sizeof(buffer[0]));
curBuffer ^= 1; // Switch buffer curBuffer ^= 1; // Switch buffer
// Comment from sample code: // Comment from sample code:
@ -64,15 +65,13 @@ bool OpenSLESStream::Start()
assert(SL_RESULT_SUCCESS == result); assert(SL_RESULT_SUCCESS == result);
SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2}; SLDataLocator_AndroidSimpleBufferQueue loc_bufq = {SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE, 2};
SLDataFormat_PCM format_pcm = { SLDataFormat_PCM format_pcm = {SL_DATAFORMAT_PCM,
SL_DATAFORMAT_PCM,
2, 2,
m_mixer->GetSampleRate() * 1000, m_mixer->GetSampleRate() * 1000,
SL_PCMSAMPLEFORMAT_FIXED_16, SL_PCMSAMPLEFORMAT_FIXED_16,
SL_PCMSAMPLEFORMAT_FIXED_16, SL_PCMSAMPLEFORMAT_FIXED_16,
SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT, SL_SPEAKER_FRONT_LEFT | SL_SPEAKER_FRONT_RIGHT,
SL_BYTEORDER_LITTLEENDIAN SL_BYTEORDER_LITTLEENDIAN};
};
SLDataSource audioSrc = {&loc_bufq, &format_pcm}; SLDataSource audioSrc = {&loc_bufq, &format_pcm};
@ -83,15 +82,17 @@ bool OpenSLESStream::Start()
// create audio player // create audio player
const SLInterfaceID ids[2] = {SL_IID_BUFFERQUEUE, SL_IID_VOLUME}; const SLInterfaceID ids[2] = {SL_IID_BUFFERQUEUE, SL_IID_VOLUME};
const SLboolean req[2] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE}; const SLboolean req[2] = {SL_BOOLEAN_TRUE, SL_BOOLEAN_TRUE};
result = (*engineEngine)->CreateAudioPlayer(engineEngine, &bqPlayerObject, &audioSrc, &audioSnk, 2, ids, req); result =
(*engineEngine)
->CreateAudioPlayer(engineEngine, &bqPlayerObject, &audioSrc, &audioSnk, 2, ids, req);
assert(SL_RESULT_SUCCESS == result); assert(SL_RESULT_SUCCESS == result);
result = (*bqPlayerObject)->Realize(bqPlayerObject, SL_BOOLEAN_FALSE); result = (*bqPlayerObject)->Realize(bqPlayerObject, SL_BOOLEAN_FALSE);
assert(SL_RESULT_SUCCESS == result); assert(SL_RESULT_SUCCESS == result);
result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_PLAY, &bqPlayerPlay); result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_PLAY, &bqPlayerPlay);
assert(SL_RESULT_SUCCESS == result); assert(SL_RESULT_SUCCESS == result);
result = (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_BUFFERQUEUE, result =
&bqPlayerBufferQueue); (*bqPlayerObject)->GetInterface(bqPlayerObject, SL_IID_BUFFERQUEUE, &bqPlayerBufferQueue);
assert(SL_RESULT_SUCCESS == result); assert(SL_RESULT_SUCCESS == result);
result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, nullptr); result = (*bqPlayerBufferQueue)->RegisterCallback(bqPlayerBufferQueue, bqPlayerCallback, nullptr);
assert(SL_RESULT_SUCCESS == result); assert(SL_RESULT_SUCCESS == result);

View File

@ -16,7 +16,6 @@ public:
bool Start() override; bool Start() override;
void Stop() override; void Stop() override;
static bool isValid() { return true; } static bool isValid() { return true; }
private: private:
std::thread thread; std::thread thread;
Common::Event soundSyncEvent; Common::Event soundSyncEvent;

View File

@ -7,8 +7,8 @@
#include "AudioCommon/DPL2Decoder.h" #include "AudioCommon/DPL2Decoder.h"
#include "AudioCommon/PulseAudioStream.h" #include "AudioCommon/PulseAudioStream.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/Thread.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/Thread.h"
#include "Core/ConfigManager.h" #include "Core/ConfigManager.h"
namespace namespace
@ -16,9 +16,7 @@ namespace
const size_t BUFFER_SAMPLES = 512; // ~10 ms - needs to be at least 240 for surround const size_t BUFFER_SAMPLES = 512; // ~10 ms - needs to be at least 240 for surround
} }
PulseAudio::PulseAudio() PulseAudio::PulseAudio() : m_thread(), m_run_thread()
: m_thread()
, m_run_thread()
{ {
} }
@ -72,7 +70,8 @@ bool PulseAudio::PulseInit()
m_pa_connected = 0; m_pa_connected = 0;
// create pulseaudio main loop and context // create pulseaudio main loop and context
// also register the async state callback which is called when the connection to the pa server has changed // also register the async state callback which is called when the connection to the pa server has
// changed
m_pa_ml = pa_mainloop_new(); m_pa_ml = pa_mainloop_new();
m_pa_mlapi = pa_mainloop_get_api(m_pa_ml); m_pa_mlapi = pa_mainloop_get_api(m_pa_ml);
m_pa_ctx = pa_context_new(m_pa_mlapi, "dolphin-emu"); m_pa_ctx = pa_context_new(m_pa_mlapi, "dolphin-emu");
@ -126,8 +125,11 @@ bool PulseAudio::PulseInit()
m_pa_ba.maxlength = -1; // max buffer, so also max latency m_pa_ba.maxlength = -1; // max buffer, so also max latency
m_pa_ba.minreq = -1; // don't read every byte, try to group them _a bit_ m_pa_ba.minreq = -1; // don't read every byte, try to group them _a bit_
m_pa_ba.prebuf = -1; // start as early as possible m_pa_ba.prebuf = -1; // start as early as possible
m_pa_ba.tlength = BUFFER_SAMPLES * m_channels * m_bytespersample; // designed latency, only change this flag for low latency output m_pa_ba.tlength =
pa_stream_flags flags = pa_stream_flags(PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_ADJUST_LATENCY | PA_STREAM_AUTO_TIMING_UPDATE); BUFFER_SAMPLES * m_channels *
m_bytespersample; // designed latency, only change this flag for low latency output
pa_stream_flags flags = pa_stream_flags(PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_ADJUST_LATENCY |
PA_STREAM_AUTO_TIMING_UPDATE);
m_pa_error = pa_stream_connect_playback(m_pa_s, nullptr, &m_pa_ba, flags, nullptr, nullptr); m_pa_error = pa_stream_connect_playback(m_pa_s, nullptr, &m_pa_ba, flags, nullptr, nullptr);
if (m_pa_error < 0) if (m_pa_error < 0)
{ {
@ -188,7 +190,7 @@ void PulseAudio::WriteCallback(pa_stream* s, size_t length)
if (m_stereo) if (m_stereo)
{ {
// use the raw s16 stereo mix // use the raw s16 stereo mix
m_mixer->Mix((s16*) buffer, frames); m_mixer->Mix((s16*)buffer, frames);
} }
else else
{ {
@ -198,7 +200,7 @@ void PulseAudio::WriteCallback(pa_stream* s, size_t length)
float floatbuffer_stereo[frames * 2]; float floatbuffer_stereo[frames * 2];
// s16 to float // s16 to float
for (int i=0; i < frames * 2; ++i) for (int i = 0; i < frames * 2; ++i)
{ {
floatbuffer_stereo[i] = s16buffer_stereo[i] / float(1 << 15); floatbuffer_stereo[i] = s16buffer_stereo[i] / float(1 << 15);
} }
@ -211,10 +213,10 @@ void PulseAudio::WriteCallback(pa_stream* s, size_t length)
// Discard the subwoofer channel - DPL2Decode generates a pretty // Discard the subwoofer channel - DPL2Decode generates a pretty
// good 5.0 but not a good 5.1 output. // good 5.0 but not a good 5.1 output.
const int dpl2_to_5chan[] = {0,1,2,4,5}; const int dpl2_to_5chan[] = {0, 1, 2, 4, 5};
for (int i=0; i < frames; ++i) for (int i = 0; i < frames; ++i)
{ {
for (int j=0; j < m_channels; ++j) for (int j = 0; j < m_channels; ++j)
{ {
((float*)buffer)[m_channels * i + j] = floatbuffer_6chan[6 * i + dpl2_to_5chan[j]]; ((float*)buffer)[m_channels * i + j] = floatbuffer_6chan[6 * i + dpl2_to_5chan[j]];
} }
@ -234,18 +236,18 @@ void PulseAudio::WriteCallback(pa_stream* s, size_t length)
void PulseAudio::StateCallback(pa_context* c, void* userdata) void PulseAudio::StateCallback(pa_context* c, void* userdata)
{ {
PulseAudio* p = (PulseAudio*) userdata; PulseAudio* p = (PulseAudio*)userdata;
p->StateCallback(c); p->StateCallback(c);
} }
void PulseAudio::UnderflowCallback(pa_stream* s, void* userdata) void PulseAudio::UnderflowCallback(pa_stream* s, void* userdata)
{ {
PulseAudio* p = (PulseAudio*) userdata; PulseAudio* p = (PulseAudio*)userdata;
p->UnderflowCallback(s); p->UnderflowCallback(s);
} }
void PulseAudio::WriteCallback(pa_stream* s, size_t length, void* userdata) void PulseAudio::WriteCallback(pa_stream* s, size_t length, void* userdata)
{ {
PulseAudio* p = (PulseAudio*) userdata; PulseAudio* p = (PulseAudio*)userdata;
p->WriteCallback(s, length); p->WriteCallback(s, length);
} }

View File

@ -25,10 +25,9 @@ public:
void Update() override; void Update() override;
static bool isValid() { return true; } static bool isValid() { return true; }
void StateCallback(pa_context* c);
void StateCallback(pa_context *c); void WriteCallback(pa_stream* s, size_t length);
void WriteCallback(pa_stream *s, size_t length); void UnderflowCallback(pa_stream* s);
void UnderflowCallback(pa_stream *s);
private: private:
void SoundLoop() override; void SoundLoop() override;
@ -37,9 +36,9 @@ private:
void PulseShutdown(); void PulseShutdown();
// wrapper callback functions, last parameter _must_ be PulseAudio* // wrapper callback functions, last parameter _must_ be PulseAudio*
static void StateCallback(pa_context *c, void *userdata); static void StateCallback(pa_context* c, void* userdata);
static void WriteCallback(pa_stream *s, size_t length, void *userdata); static void WriteCallback(pa_stream* s, size_t length, void* userdata);
static void UnderflowCallback(pa_stream *s, void *userdata); static void UnderflowCallback(pa_stream* s, void* userdata);
std::thread m_thread; std::thread m_thread;
std::atomic<bool> m_run_thread; std::atomic<bool> m_run_thread;
@ -50,10 +49,10 @@ private:
int m_pa_error; int m_pa_error;
int m_pa_connected; int m_pa_connected;
pa_mainloop *m_pa_ml; pa_mainloop* m_pa_ml;
pa_mainloop_api *m_pa_mlapi; pa_mainloop_api* m_pa_mlapi;
pa_context *m_pa_ctx; pa_context* m_pa_ctx;
pa_stream *m_pa_s; pa_stream* m_pa_s;
pa_buffer_attr m_pa_ba; pa_buffer_attr m_pa_ba;
#endif #endif
}; };

View File

@ -21,8 +21,7 @@ protected:
public: public:
SoundStream() : m_mixer(new CMixer(48000)), m_logAudio(false), m_muted(false) {} SoundStream() : m_mixer(new CMixer(48000)), m_logAudio(false), m_muted(false) {}
virtual ~SoundStream() { } virtual ~SoundStream() {}
static bool isValid() { return false; } static bool isValid() { return false; }
CMixer* GetMixer() const { return m_mixer.get(); } CMixer* GetMixer() const { return m_mixer.get(); }
virtual bool Start() { return false; } virtual bool Start() { return false; }
@ -32,7 +31,6 @@ public:
virtual void Update() {} virtual void Update() {}
virtual void Clear(bool mute) { m_muted = mute; } virtual void Clear(bool mute) { m_muted = mute; }
bool IsMuted() const { return m_muted; } bool IsMuted() const { return m_muted; }
void StartLogAudio(const std::string& filename) void StartLogAudio(const std::string& filename)
{ {
if (!m_logAudio) if (!m_logAudio)

View File

@ -25,14 +25,17 @@ bool WaveFileWriter::Start(const std::string& filename, unsigned int HLESampleRa
// Check if the file is already open // Check if the file is already open
if (file) if (file)
{ {
PanicAlertT("The file %s was already open, the file header will not be written.", filename.c_str()); PanicAlertT("The file %s was already open, the file header will not be written.",
filename.c_str());
return false; return false;
} }
file.Open(filename, "wb"); file.Open(filename, "wb");
if (!file) if (!file)
{ {
PanicAlertT("The file %s could not be opened for writing. Please check if it's already opened by another program.", filename.c_str()); PanicAlertT("The file %s could not be opened for writing. Please check if it's already opened "
"by another program.",
filename.c_str());
return false; return false;
} }
@ -47,11 +50,11 @@ bool WaveFileWriter::Start(const std::string& filename, unsigned int HLESampleRa
Write4("fmt "); Write4("fmt ");
Write(16); // size of fmt block Write(16); // size of fmt block
Write(0x00020001); //two channels, uncompressed Write(0x00020001); // two channels, uncompressed
const u32 sample_rate = HLESampleRate; const u32 sample_rate = HLESampleRate;
Write(sample_rate); Write(sample_rate);
Write(sample_rate * 2 * 2); //two channels, 16bit Write(sample_rate * 2 * 2); // two channels, 16bit
Write(0x00100004); Write(0x00100004);
Write4("data"); Write4("data");
@ -81,12 +84,12 @@ void WaveFileWriter::Write(u32 value)
file.WriteArray(&value, 1); file.WriteArray(&value, 1);
} }
void WaveFileWriter::Write4(const char *ptr) void WaveFileWriter::Write4(const char* ptr)
{ {
file.WriteBytes(ptr, 4); file.WriteBytes(ptr, 4);
} }
void WaveFileWriter::AddStereoSamples(const short *sample_data, u32 count) void WaveFileWriter::AddStereoSamples(const short* sample_data, u32 count)
{ {
if (!file) if (!file)
PanicAlertT("WaveFileWriter - file not open."); PanicAlertT("WaveFileWriter - file not open.");
@ -109,7 +112,7 @@ void WaveFileWriter::AddStereoSamples(const short *sample_data, u32 count)
audio_size += count * 4; audio_size += count * 4;
} }
void WaveFileWriter::AddStereoSamplesBE(const short *sample_data, u32 count) void WaveFileWriter::AddStereoSamplesBE(const short* sample_data, u32 count)
{ {
if (!file) if (!file)
PanicAlertT("WaveFileWriter - file not open."); PanicAlertT("WaveFileWriter - file not open.");
@ -133,7 +136,7 @@ void WaveFileWriter::AddStereoSamplesBE(const short *sample_data, u32 count)
for (u32 i = 0; i < count; i++) for (u32 i = 0; i < count; i++)
{ {
//Flip the audio channels from RL to LR // Flip the audio channels from RL to LR
conv_buffer[2 * i] = Common::swap16((u16)sample_data[2 * i + 1]); conv_buffer[2 * i] = Common::swap16((u16)sample_data[2 * i + 1]);
conv_buffer[2 * i + 1] = Common::swap16((u16)sample_data[2 * i]); conv_buffer[2 * i + 1] = Common::swap16((u16)sample_data[2 * i]);
} }

View File

@ -30,11 +30,9 @@ public:
void Stop(); void Stop();
void SetSkipSilence(bool skip) { skip_silence = skip; } void SetSkipSilence(bool skip) { skip_silence = skip; }
void AddStereoSamples(const short* sample_data, u32 count);
void AddStereoSamples(const short *sample_data, u32 count); void AddStereoSamplesBE(const short* sample_data, u32 count); // big endian
void AddStereoSamplesBE(const short *sample_data, u32 count); // big endian
u32 GetAudioSize() const { return audio_size; } u32 GetAudioSize() const { return audio_size; }
private: private:
static constexpr size_t BUFFER_SIZE = 32 * 1024; static constexpr size_t BUFFER_SIZE = 32 * 1024;

View File

@ -2,12 +2,12 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include "AudioCommon/XAudio2Stream.h"
#include <xaudio2.h> #include <xaudio2.h>
#include "AudioCommon/AudioCommon.h" #include "AudioCommon/AudioCommon.h"
#include "AudioCommon/XAudio2Stream.h"
#include "Common/Event.h" #include "Common/Event.h"
#include "Common/MsgHandler.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#ifndef XAUDIO2_DLL #ifndef XAUDIO2_DLL
#error You are building this module against the wrong version of DirectX. You probably need to remove DXSDK_DIR from your include path. #error You are building this module against the wrong version of DirectX. You probably need to remove DXSDK_DIR from your include path.
@ -24,21 +24,20 @@ private:
void SubmitBuffer(PBYTE buf_data); void SubmitBuffer(PBYTE buf_data);
public: public:
StreamingVoiceContext(IXAudio2 *pXAudio2, CMixer *pMixer, Common::Event& pSyncEvent); StreamingVoiceContext(IXAudio2* pXAudio2, CMixer* pMixer, Common::Event& pSyncEvent);
~StreamingVoiceContext(); ~StreamingVoiceContext();
void StreamingVoiceContext::Stop(); void StreamingVoiceContext::Stop();
void StreamingVoiceContext::Play(); void StreamingVoiceContext::Play();
STDMETHOD_(void, OnVoiceError) (THIS_ void* pBufferContext, HRESULT Error) {} STDMETHOD_(void, OnVoiceError)(THIS_ void* pBufferContext, HRESULT Error) {}
STDMETHOD_(void, OnVoiceProcessingPassStart) (UINT32) {} STDMETHOD_(void, OnVoiceProcessingPassStart)(UINT32) {}
STDMETHOD_(void, OnVoiceProcessingPassEnd) () {} STDMETHOD_(void, OnVoiceProcessingPassEnd)() {}
STDMETHOD_(void, OnBufferStart) (void*) {} STDMETHOD_(void, OnBufferStart)(void*) {}
STDMETHOD_(void, OnLoopEnd) (void*) {} STDMETHOD_(void, OnLoopEnd)(void*) {}
STDMETHOD_(void, OnStreamEnd) () {} STDMETHOD_(void, OnStreamEnd)() {}
STDMETHOD_(void, OnBufferEnd)(void* context);
STDMETHOD_(void, OnBufferEnd) (void* context);
}; };
const int NUM_BUFFERS = 3; const int NUM_BUFFERS = 3;
@ -58,10 +57,10 @@ void StreamingVoiceContext::SubmitBuffer(PBYTE buf_data)
m_source_voice->SubmitSourceBuffer(&buf); m_source_voice->SubmitSourceBuffer(&buf);
} }
StreamingVoiceContext::StreamingVoiceContext(IXAudio2 *pXAudio2, CMixer *pMixer, Common::Event& pSyncEvent) StreamingVoiceContext::StreamingVoiceContext(IXAudio2* pXAudio2, CMixer* pMixer,
: m_mixer(pMixer) Common::Event& pSyncEvent)
, m_sound_sync_event(pSyncEvent) : m_mixer(pMixer), m_sound_sync_event(pSyncEvent),
, xaudio_buffer(new BYTE[NUM_BUFFERS * BUFFER_SIZE_BYTES]()) xaudio_buffer(new BYTE[NUM_BUFFERS * BUFFER_SIZE_BYTES]())
{ {
WAVEFORMATEXTENSIBLE wfx = {}; WAVEFORMATEXTENSIBLE wfx = {};
@ -69,7 +68,7 @@ StreamingVoiceContext::StreamingVoiceContext(IXAudio2 *pXAudio2, CMixer *pMixer,
wfx.Format.nSamplesPerSec = m_mixer->GetSampleRate(); wfx.Format.nSamplesPerSec = m_mixer->GetSampleRate();
wfx.Format.nChannels = 2; wfx.Format.nChannels = 2;
wfx.Format.wBitsPerSample = 16; wfx.Format.wBitsPerSample = 16;
wfx.Format.nBlockAlign = wfx.Format.nChannels*wfx.Format.wBitsPerSample / 8; wfx.Format.nBlockAlign = wfx.Format.nChannels * wfx.Format.wBitsPerSample / 8;
wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign; wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign;
wfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); wfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
wfx.Samples.wValidBitsPerSample = 16; wfx.Samples.wValidBitsPerSample = 16;
@ -78,7 +77,8 @@ StreamingVoiceContext::StreamingVoiceContext(IXAudio2 *pXAudio2, CMixer *pMixer,
// create source voice // create source voice
HRESULT hr; HRESULT hr;
if (FAILED(hr = pXAudio2->CreateSourceVoice(&m_source_voice, &wfx.Format, XAUDIO2_VOICE_NOSRC, 1.0f, this))) if (FAILED(hr = pXAudio2->CreateSourceVoice(&m_source_voice, &wfx.Format, XAUDIO2_VOICE_NOSRC,
1.0f, this)))
{ {
PanicAlert("XAudio2 CreateSourceVoice failed: %#X", hr); PanicAlert("XAudio2 CreateSourceVoice failed: %#X", hr);
return; return;
@ -119,8 +119,8 @@ void StreamingVoiceContext::OnBufferEnd(void* context)
if (!m_source_voice || !context) if (!m_source_voice || !context)
return; return;
//m_sound_sync_event->Wait(); // sync // m_sound_sync_event->Wait(); // sync
//m_sound_sync_event->Spin(); // or tight sync // m_sound_sync_event->Spin(); // or tight sync
m_mixer->Mix(static_cast<short*>(context), SAMPLES_PER_BUFFER); m_mixer->Mix(static_cast<short*>(context), SAMPLES_PER_BUFFER);
SubmitBuffer(static_cast<BYTE*>(context)); SubmitBuffer(static_cast<BYTE*>(context));
@ -128,7 +128,7 @@ void StreamingVoiceContext::OnBufferEnd(void* context)
HMODULE XAudio2::m_xaudio2_dll = nullptr; HMODULE XAudio2::m_xaudio2_dll = nullptr;
typedef decltype(&XAudio2Create) XAudio2Create_t; typedef decltype(&XAudio2Create) XAudio2Create_t;
void *XAudio2::PXAudio2Create = nullptr; void* XAudio2::PXAudio2Create = nullptr;
bool XAudio2::InitLibrary() bool XAudio2::InitLibrary()
{ {
@ -158,9 +158,8 @@ bool XAudio2::InitLibrary()
} }
XAudio2::XAudio2() XAudio2::XAudio2()
: m_mastering_voice(nullptr) : m_mastering_voice(nullptr), m_volume(1.0f),
, m_volume(1.0f) m_cleanup_com(SUCCEEDED(CoInitializeEx(nullptr, COINIT_MULTITHREADED)))
, m_cleanup_com(SUCCEEDED(CoInitializeEx(nullptr, COINIT_MULTITHREADED)))
{ {
} }
@ -197,15 +196,15 @@ bool XAudio2::Start()
// Volume // Volume
m_mastering_voice->SetVolume(m_volume); m_mastering_voice->SetVolume(m_volume);
m_voice_context = std::unique_ptr<StreamingVoiceContext> m_voice_context = std::unique_ptr<StreamingVoiceContext>(
(new StreamingVoiceContext(m_xaudio2.get(), m_mixer.get(), m_sound_sync_event)); new StreamingVoiceContext(m_xaudio2.get(), m_mixer.get(), m_sound_sync_event));
return true; return true;
} }
void XAudio2::SetVolume(int volume) void XAudio2::SetVolume(int volume)
{ {
//linear 1- .01 // linear 1- .01
m_volume = (float)volume / 100.f; m_volume = (float)volume / 100.f;
if (m_mastering_voice) if (m_mastering_voice)
@ -227,7 +226,7 @@ void XAudio2::Clear(bool mute)
void XAudio2::Stop() void XAudio2::Stop()
{ {
//m_sound_sync_event.Set(); // m_sound_sync_event.Set();
m_voice_context.reset(); m_voice_context.reset();

View File

@ -38,7 +38,7 @@ private:
std::unique_ptr<IXAudio2, Releaser> m_xaudio2; std::unique_ptr<IXAudio2, Releaser> m_xaudio2;
std::unique_ptr<StreamingVoiceContext> m_voice_context; std::unique_ptr<StreamingVoiceContext> m_voice_context;
IXAudio2MasteringVoice *m_mastering_voice; IXAudio2MasteringVoice* m_mastering_voice;
Common::Event m_sound_sync_event; Common::Event m_sound_sync_event;
float m_volume; float m_volume;
@ -46,7 +46,7 @@ private:
const bool m_cleanup_com; const bool m_cleanup_com;
static HMODULE m_xaudio2_dll; static HMODULE m_xaudio2_dll;
static void *PXAudio2Create; static void* PXAudio2Create;
static bool InitLibrary(); static bool InitLibrary();

View File

@ -10,8 +10,8 @@
#include "AudioCommon/AudioCommon.h" #include "AudioCommon/AudioCommon.h"
#include "AudioCommon/XAudio2_7Stream.h" #include "AudioCommon/XAudio2_7Stream.h"
#include "Common/Event.h" #include "Common/Event.h"
#include "Common/MsgHandler.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
struct StreamingVoiceContext2_7 : public IXAudio2VoiceCallback struct StreamingVoiceContext2_7 : public IXAudio2VoiceCallback
{ {
@ -24,21 +24,20 @@ private:
void SubmitBuffer(PBYTE buf_data); void SubmitBuffer(PBYTE buf_data);
public: public:
StreamingVoiceContext2_7(IXAudio2 *pXAudio2, CMixer *pMixer, Common::Event& pSyncEvent); StreamingVoiceContext2_7(IXAudio2* pXAudio2, CMixer* pMixer, Common::Event& pSyncEvent);
~StreamingVoiceContext2_7(); ~StreamingVoiceContext2_7();
void StreamingVoiceContext2_7::Stop(); void StreamingVoiceContext2_7::Stop();
void StreamingVoiceContext2_7::Play(); void StreamingVoiceContext2_7::Play();
STDMETHOD_(void, OnVoiceError) (THIS_ void* pBufferContext, HRESULT Error) {} STDMETHOD_(void, OnVoiceError)(THIS_ void* pBufferContext, HRESULT Error) {}
STDMETHOD_(void, OnVoiceProcessingPassStart) (UINT32) {} STDMETHOD_(void, OnVoiceProcessingPassStart)(UINT32) {}
STDMETHOD_(void, OnVoiceProcessingPassEnd) () {} STDMETHOD_(void, OnVoiceProcessingPassEnd)() {}
STDMETHOD_(void, OnBufferStart) (void*) {} STDMETHOD_(void, OnBufferStart)(void*) {}
STDMETHOD_(void, OnLoopEnd) (void*) {} STDMETHOD_(void, OnLoopEnd)(void*) {}
STDMETHOD_(void, OnStreamEnd) () {} STDMETHOD_(void, OnStreamEnd)() {}
STDMETHOD_(void, OnBufferEnd)(void* context);
STDMETHOD_(void, OnBufferEnd) (void* context);
}; };
const int NUM_BUFFERS = 3; const int NUM_BUFFERS = 3;
@ -58,10 +57,10 @@ void StreamingVoiceContext2_7::SubmitBuffer(PBYTE buf_data)
m_source_voice->SubmitSourceBuffer(&buf); m_source_voice->SubmitSourceBuffer(&buf);
} }
StreamingVoiceContext2_7::StreamingVoiceContext2_7(IXAudio2 *pXAudio2, CMixer *pMixer, Common::Event& pSyncEvent) StreamingVoiceContext2_7::StreamingVoiceContext2_7(IXAudio2* pXAudio2, CMixer* pMixer,
: m_mixer(pMixer) Common::Event& pSyncEvent)
, m_sound_sync_event(pSyncEvent) : m_mixer(pMixer), m_sound_sync_event(pSyncEvent),
, xaudio_buffer(new BYTE[NUM_BUFFERS * BUFFER_SIZE_BYTES]()) xaudio_buffer(new BYTE[NUM_BUFFERS * BUFFER_SIZE_BYTES]())
{ {
WAVEFORMATEXTENSIBLE wfx = {}; WAVEFORMATEXTENSIBLE wfx = {};
@ -69,7 +68,7 @@ StreamingVoiceContext2_7::StreamingVoiceContext2_7(IXAudio2 *pXAudio2, CMixer *p
wfx.Format.nSamplesPerSec = m_mixer->GetSampleRate(); wfx.Format.nSamplesPerSec = m_mixer->GetSampleRate();
wfx.Format.nChannels = 2; wfx.Format.nChannels = 2;
wfx.Format.wBitsPerSample = 16; wfx.Format.wBitsPerSample = 16;
wfx.Format.nBlockAlign = wfx.Format.nChannels*wfx.Format.wBitsPerSample / 8; wfx.Format.nBlockAlign = wfx.Format.nChannels * wfx.Format.wBitsPerSample / 8;
wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign; wfx.Format.nAvgBytesPerSec = wfx.Format.nSamplesPerSec * wfx.Format.nBlockAlign;
wfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); wfx.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX);
wfx.Samples.wValidBitsPerSample = 16; wfx.Samples.wValidBitsPerSample = 16;
@ -78,7 +77,8 @@ StreamingVoiceContext2_7::StreamingVoiceContext2_7(IXAudio2 *pXAudio2, CMixer *p
// create source voice // create source voice
HRESULT hr; HRESULT hr;
if (FAILED(hr = pXAudio2->CreateSourceVoice(&m_source_voice, &wfx.Format, XAUDIO2_VOICE_NOSRC, 1.0f, this))) if (FAILED(hr = pXAudio2->CreateSourceVoice(&m_source_voice, &wfx.Format, XAUDIO2_VOICE_NOSRC,
1.0f, this)))
{ {
PanicAlert("XAudio2_7 CreateSourceVoice failed: %#X", hr); PanicAlert("XAudio2_7 CreateSourceVoice failed: %#X", hr);
return; return;
@ -119,8 +119,8 @@ void StreamingVoiceContext2_7::OnBufferEnd(void* context)
if (!m_source_voice || !context) if (!m_source_voice || !context)
return; return;
//m_sound_sync_event->Wait(); // sync // m_sound_sync_event->Wait(); // sync
//m_sound_sync_event->Spin(); // or tight sync // m_sound_sync_event->Spin(); // or tight sync
m_mixer->Mix(static_cast<short*>(context), SAMPLES_PER_BUFFER); m_mixer->Mix(static_cast<short*>(context), SAMPLES_PER_BUFFER);
SubmitBuffer(static_cast<BYTE*>(context)); SubmitBuffer(static_cast<BYTE*>(context));
@ -146,9 +146,8 @@ bool XAudio2_7::InitLibrary()
} }
XAudio2_7::XAudio2_7() XAudio2_7::XAudio2_7()
: m_mastering_voice(nullptr) : m_mastering_voice(nullptr), m_volume(1.0f),
, m_volume(1.0f) m_cleanup_com(SUCCEEDED(CoInitializeEx(nullptr, COINIT_MULTITHREADED)))
, m_cleanup_com(SUCCEEDED(CoInitializeEx(nullptr, COINIT_MULTITHREADED)))
{ {
} }
@ -185,15 +184,15 @@ bool XAudio2_7::Start()
// Volume // Volume
m_mastering_voice->SetVolume(m_volume); m_mastering_voice->SetVolume(m_volume);
m_voice_context = std::unique_ptr<StreamingVoiceContext2_7> m_voice_context = std::unique_ptr<StreamingVoiceContext2_7>(
(new StreamingVoiceContext2_7(m_xaudio2.get(), m_mixer.get(), m_sound_sync_event)); new StreamingVoiceContext2_7(m_xaudio2.get(), m_mixer.get(), m_sound_sync_event));
return true; return true;
} }
void XAudio2_7::SetVolume(int volume) void XAudio2_7::SetVolume(int volume)
{ {
//linear 1- .01 // linear 1- .01
m_volume = (float)volume / 100.f; m_volume = (float)volume / 100.f;
if (m_mastering_voice) if (m_mastering_voice)
@ -215,7 +214,7 @@ void XAudio2_7::Clear(bool mute)
void XAudio2_7::Stop() void XAudio2_7::Stop()
{ {
//m_sound_sync_event.Set(); // m_sound_sync_event.Set();
m_voice_context.reset(); m_voice_context.reset();

View File

@ -32,13 +32,13 @@ class XAudio2_7 final : public SoundStream
#ifdef _WIN32 #ifdef _WIN32
private: private:
static void ReleaseIXAudio2(IXAudio2 *ptr); static void ReleaseIXAudio2(IXAudio2* ptr);
class Releaser class Releaser
{ {
public: public:
template <typename R> template <typename R>
void operator()(R *ptr) void operator()(R* ptr)
{ {
ReleaseIXAudio2(ptr); ReleaseIXAudio2(ptr);
} }
@ -46,7 +46,7 @@ private:
std::unique_ptr<IXAudio2, Releaser> m_xaudio2; std::unique_ptr<IXAudio2, Releaser> m_xaudio2;
std::unique_ptr<StreamingVoiceContext2_7> m_voice_context; std::unique_ptr<StreamingVoiceContext2_7> m_voice_context;
IXAudio2MasteringVoice *m_mastering_voice; IXAudio2MasteringVoice* m_mastering_voice;
Common::Event m_sound_sync_event; Common::Event m_sound_sync_event;
float m_volume; float m_volume;

View File

@ -6,23 +6,35 @@
* Copyright (c) 2006, Creative Labs Inc. * Copyright (c) 2006, Creative Labs Inc.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided * Redistribution and use in source and binary forms, with or without modification, are permitted
* provided
* that the following conditions are met: * that the following conditions are met:
* *
* * Redistributions of source code must retain the above copyright notice, this list of conditions and * * Redistributions of source code must retain the above copyright notice, this list of
* conditions and
* the following disclaimer. * the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions * * Redistributions in binary form must reproduce the above copyright notice, this list of
* and the following disclaimer in the documentation and/or other materials provided with the distribution. * conditions
* * Neither the name of Creative Labs Inc. nor the names of its contributors may be used to endorse or * and the following disclaimer in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Creative Labs Inc. nor the names of its contributors may be used to
* endorse or
* promote products derived from this software without specific prior written permission. * promote products derived from this software without specific prior written permission.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * IMPLIED
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED * FOR A
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * LIABLE FOR
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
*/ */
@ -42,7 +54,6 @@
#include <AL/alc.h> #include <AL/alc.h>
#endif #endif
/* /*
* Init call * Init call
*/ */
@ -50,34 +61,38 @@ ALDeviceList::ALDeviceList()
{ {
ALDEVICEINFO ALDeviceInfo; ALDEVICEINFO ALDeviceInfo;
// DeviceInfo vector stores, for each enumerated device, it's device name, selection status, spec version #, and extension support // DeviceInfo vector stores, for each enumerated device, it's device name, selection status, spec
// version #, and extension support
vDeviceInfo.clear(); vDeviceInfo.clear();
vDeviceInfo.reserve(10); vDeviceInfo.reserve(10);
defaultDeviceIndex = 0; defaultDeviceIndex = 0;
// grab function pointers for 1.0-API functions, and if successful proceed to enumerate all devices // grab function pointers for 1.0-API functions, and if successful proceed to enumerate all
//if (LoadOAL10Library(nullptr, &ALFunction) == TRUE) { // devices
// if (LoadOAL10Library(nullptr, &ALFunction) == TRUE) {
if (alcIsExtensionPresent(nullptr, "ALC_ENUMERATION_EXT")) if (alcIsExtensionPresent(nullptr, "ALC_ENUMERATION_EXT"))
{ {
const char *devices = alcGetString(nullptr, ALC_DEVICE_SPECIFIER); const char* devices = alcGetString(nullptr, ALC_DEVICE_SPECIFIER);
const char *defaultDeviceName = alcGetString(nullptr, ALC_DEFAULT_DEVICE_SPECIFIER); const char* defaultDeviceName = alcGetString(nullptr, ALC_DEFAULT_DEVICE_SPECIFIER);
// go through device list (each device terminated with a single nullptr, list terminated with double nullptr) // go through device list (each device terminated with a single nullptr, list terminated with
for (s32 index = 0; devices != nullptr && strlen(devices) > 0; index++, devices += strlen(devices) + 1) // double nullptr)
for (s32 index = 0; devices != nullptr && strlen(devices) > 0;
index++, devices += strlen(devices) + 1)
{ {
if (strcmp(defaultDeviceName, devices) == 0) if (strcmp(defaultDeviceName, devices) == 0)
{ {
defaultDeviceIndex = index; defaultDeviceIndex = index;
} }
ALCdevice *device = alcOpenDevice(devices); ALCdevice* device = alcOpenDevice(devices);
if (device) if (device)
{ {
ALCcontext *context = alcCreateContext(device, nullptr); ALCcontext* context = alcCreateContext(device, nullptr);
if (context) if (context)
{ {
alcMakeContextCurrent(context); alcMakeContextCurrent(context);
// if new actual device name isn't already in the list, then add it... // if new actual device name isn't already in the list, then add it...
const char *actualDeviceName = alcGetString(device, ALC_DEVICE_SPECIFIER); const char* actualDeviceName = alcGetString(device, ALC_DEVICE_SPECIFIER);
bool bNewName = true; bool bNewName = true;
for (s32 i = 0; i < GetNumDevices(); i++) for (s32 i = 0; i < GetNumDevices(); i++)
{ {
@ -167,18 +182,19 @@ s32 ALDeviceList::GetNumDevices()
/* /*
* Returns the device name at an index in the complete device list * Returns the device name at an index in the complete device list
*/ */
char * ALDeviceList::GetDeviceName(s32 index) char* ALDeviceList::GetDeviceName(s32 index)
{ {
if (index < GetNumDevices()) if (index < GetNumDevices())
return (char *)vDeviceInfo[index].strDeviceName.c_str(); return (char*)vDeviceInfo[index].strDeviceName.c_str();
else else
return nullptr; return nullptr;
} }
/* /*
* Returns the major and minor version numbers for a device at a specified index in the complete list * Returns the major and minor version numbers for a device at a specified index in the complete
* list
*/ */
void ALDeviceList::GetDeviceVersion(s32 index, s32 *major, s32 *minor) void ALDeviceList::GetDeviceVersion(s32 index, s32* major, s32* minor)
{ {
if (index < GetNumDevices()) if (index < GetNumDevices())
{ {
@ -203,7 +219,7 @@ u32 ALDeviceList::GetMaxNumSources(s32 index)
/* /*
* Checks if the extension is supported on the given device * Checks if the extension is supported on the given device
*/ */
bool ALDeviceList::IsExtensionSupported(s32 index, char *szExtName) bool ALDeviceList::IsExtensionSupported(s32 index, char* szExtName)
{ {
bool bReturn = false; bool bReturn = false;
@ -265,7 +281,7 @@ void ALDeviceList::FilterDevicesMaxVer(s32 major, s32 minor)
/* /*
* Deselects device which don't support the given extension name * Deselects device which don't support the given extension name
*/ */
void ALDeviceList::FilterDevicesExtension(char *szExtName) void ALDeviceList::FilterDevicesExtension(char* szExtName)
{ {
bool bFound; bool bFound;

View File

@ -10,8 +10,8 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#ifdef _WIN32 #ifdef _WIN32
#pragma warning(disable: 4786) //disable warning "identifier was truncated to #pragma warning(disable : 4786) // disable warning "identifier was truncated to
//'255' characters in the browser information" //'255' characters in the browser information"
#endif #endif
typedef struct typedef struct

View File

@ -4,8 +4,8 @@
#include <cmath> #include <cmath>
#include <cstdio> #include <cstdio>
#include <string>
#include <curl/curl.h> #include <curl/curl.h>
#include <string>
#include "Common/Analytics.h" #include "Common/Analytics.h"
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
@ -43,12 +43,10 @@ void AppendVarInt(std::string* out, u64 v)
v >>= 7; v >>= 7;
current_byte |= (!!v) << 7; current_byte |= (!!v) << 7;
out->push_back(current_byte); out->push_back(current_byte);
} } while (v);
while (v);
} }
void AppendBytes(std::string* out, const u8* bytes, u32 length, void AppendBytes(std::string* out, const u8* bytes, u32 length, bool encode_length = true)
bool encode_length = true)
{ {
if (encode_length) if (encode_length)
{ {
@ -75,58 +73,50 @@ AnalyticsReportBuilder::AnalyticsReportBuilder()
m_report.push_back(WIRE_FORMAT_VERSION); m_report.push_back(WIRE_FORMAT_VERSION);
} }
void AnalyticsReportBuilder::AppendSerializedValue(std::string* report, void AnalyticsReportBuilder::AppendSerializedValue(std::string* report, const std::string& v)
const std::string& v)
{ {
AppendType(report, TypeId::STRING); AppendType(report, TypeId::STRING);
AppendBytes(report, reinterpret_cast<const u8*>(v.data()), static_cast<u32>(v.size())); AppendBytes(report, reinterpret_cast<const u8*>(v.data()), static_cast<u32>(v.size()));
} }
void AnalyticsReportBuilder::AppendSerializedValue(std::string* report, void AnalyticsReportBuilder::AppendSerializedValue(std::string* report, const char* v)
const char* v)
{ {
AppendSerializedValue(report, std::string(v)); AppendSerializedValue(report, std::string(v));
} }
void AnalyticsReportBuilder::AppendSerializedValue(std::string* report, void AnalyticsReportBuilder::AppendSerializedValue(std::string* report, bool v)
bool v)
{ {
AppendType(report, TypeId::BOOL); AppendType(report, TypeId::BOOL);
AppendBool(report, v); AppendBool(report, v);
} }
void AnalyticsReportBuilder::AppendSerializedValue(std::string* report, void AnalyticsReportBuilder::AppendSerializedValue(std::string* report, u64 v)
u64 v)
{ {
AppendType(report, TypeId::UINT); AppendType(report, TypeId::UINT);
AppendVarInt(report, v); AppendVarInt(report, v);
} }
void AnalyticsReportBuilder::AppendSerializedValue(std::string* report, void AnalyticsReportBuilder::AppendSerializedValue(std::string* report, s64 v)
s64 v)
{ {
AppendType(report, TypeId::SINT); AppendType(report, TypeId::SINT);
AppendBool(report, v >= 0); AppendBool(report, v >= 0);
AppendVarInt(report, static_cast<u64>(std::abs(v))); AppendVarInt(report, static_cast<u64>(std::abs(v)));
} }
void AnalyticsReportBuilder::AppendSerializedValue(std::string* report, void AnalyticsReportBuilder::AppendSerializedValue(std::string* report, u32 v)
u32 v)
{ {
AppendSerializedValue(report, static_cast<u64>(v)); AppendSerializedValue(report, static_cast<u64>(v));
} }
void AnalyticsReportBuilder::AppendSerializedValue(std::string* report, void AnalyticsReportBuilder::AppendSerializedValue(std::string* report, s32 v)
s32 v)
{ {
AppendSerializedValue(report, static_cast<s64>(v)); AppendSerializedValue(report, static_cast<s64>(v));
} }
void AnalyticsReportBuilder::AppendSerializedValue(std::string* report, void AnalyticsReportBuilder::AppendSerializedValue(std::string* report, float v)
float v)
{ {
AppendType(report, TypeId::FLOAT); AppendType(report, TypeId::FLOAT);
AppendBytes(report, reinterpret_cast<u8*>(&v), sizeof (v), false); AppendBytes(report, reinterpret_cast<u8*>(&v), sizeof(v), false);
} }
AnalyticsReporter::AnalyticsReporter() AnalyticsReporter::AnalyticsReporter()
@ -189,8 +179,8 @@ void AnalyticsReporter::ThreadProc()
void StdoutAnalyticsBackend::Send(std::string report) void StdoutAnalyticsBackend::Send(std::string report)
{ {
printf("Analytics report sent:\n%s", HexDump( printf("Analytics report sent:\n%s",
reinterpret_cast<const u8*>(report.data()), report.size()).c_str()); HexDump(reinterpret_cast<const u8*>(report.data()), report.size()).c_str());
} }
HttpAnalyticsBackend::HttpAnalyticsBackend(const std::string& endpoint) HttpAnalyticsBackend::HttpAnalyticsBackend(const std::string& endpoint)

View File

@ -41,14 +41,12 @@ typedef void CURL;
namespace Common namespace Common
{ {
// Generic interface for an analytics reporting backends. The main // Generic interface for an analytics reporting backends. The main
// implementation used in Dolphin can be found in Core/Analytics.h. // implementation used in Dolphin can be found in Core/Analytics.h.
class AnalyticsReportingBackend class AnalyticsReportingBackend
{ {
public: public:
virtual ~AnalyticsReportingBackend() {} virtual ~AnalyticsReportingBackend() {}
// Called from the AnalyticsReporter backend thread. // Called from the AnalyticsReporter backend thread.
virtual void Send(std::string report) = 0; virtual void Send(std::string report) = 0;
}; };
@ -60,11 +58,7 @@ public:
AnalyticsReportBuilder(); AnalyticsReportBuilder();
~AnalyticsReportBuilder() = default; ~AnalyticsReportBuilder() = default;
AnalyticsReportBuilder(const AnalyticsReportBuilder& other) AnalyticsReportBuilder(const AnalyticsReportBuilder& other) { *this = other; }
{
*this = other;
}
AnalyticsReportBuilder(AnalyticsReportBuilder&& other) AnalyticsReportBuilder(AnalyticsReportBuilder&& other)
{ {
std::lock_guard<std::mutex> lk(other.m_lock); std::lock_guard<std::mutex> lk(other.m_lock);
@ -147,16 +141,13 @@ public:
// being sent. DO NOT use this builder to send a report. Only use it to add // being sent. DO NOT use this builder to send a report. Only use it to add
// new fields that should be globally available. // new fields that should be globally available.
AnalyticsReportBuilder& BaseBuilder() { return m_base_builder; } AnalyticsReportBuilder& BaseBuilder() { return m_base_builder; }
// Gets a cloned builder that can be used to send a report. // Gets a cloned builder that can be used to send a report.
AnalyticsReportBuilder Builder() const { return m_base_builder; } AnalyticsReportBuilder Builder() const { return m_base_builder; }
// Enqueues a report for sending. Consumes the report builder. // Enqueues a report for sending. Consumes the report builder.
void Send(AnalyticsReportBuilder&& report); void Send(AnalyticsReportBuilder&& report);
// For convenience. // For convenience.
void Send(AnalyticsReportBuilder& report) { Send(std::move(report)); } void Send(AnalyticsReportBuilder& report) { Send(std::move(report)); }
protected: protected:
void ThreadProc(); void ThreadProc();

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,6 @@
namespace Arm64Gen namespace Arm64Gen
{ {
// X30 serves a dual purpose as a link register // X30 serves a dual purpose as a link register
// Encoded as <u3:type><u5:reg> // Encoded as <u3:type><u5:reg>
// Types: // Types:
@ -26,54 +25,200 @@ namespace Arm64Gen
enum ARM64Reg enum ARM64Reg
{ {
// 32bit registers // 32bit registers
W0 = 0, W1, W2, W3, W4, W5, W6, W0 = 0,
W7, W8, W9, W10, W11, W12, W13, W14, W1,
W15, W16, W17, W18, W19, W20, W21, W22, W2,
W23, W24, W25, W26, W27, W28, W29, W30, W3,
W4,
W5,
W6,
W7,
W8,
W9,
W10,
W11,
W12,
W13,
W14,
W15,
W16,
W17,
W18,
W19,
W20,
W21,
W22,
W23,
W24,
W25,
W26,
W27,
W28,
W29,
W30,
WSP, // 32bit stack pointer WSP, // 32bit stack pointer
// 64bit registers // 64bit registers
X0 = 0x20, X1, X2, X3, X4, X5, X6, X0 = 0x20,
X7, X8, X9, X10, X11, X12, X13, X14, X1,
X15, X16, X17, X18, X19, X20, X21, X22, X2,
X23, X24, X25, X26, X27, X28, X29, X30, X3,
X4,
X5,
X6,
X7,
X8,
X9,
X10,
X11,
X12,
X13,
X14,
X15,
X16,
X17,
X18,
X19,
X20,
X21,
X22,
X23,
X24,
X25,
X26,
X27,
X28,
X29,
X30,
SP, // 64bit stack pointer SP, // 64bit stack pointer
// VFP single precision registers // VFP single precision registers
S0 = 0x40, S1, S2, S3, S4, S5, S6, S0 = 0x40,
S7, S8, S9, S10, S11, S12, S13, S1,
S14, S15, S16, S17, S18, S19, S20, S2,
S21, S22, S23, S24, S25, S26, S27, S3,
S28, S29, S30, S31, S4,
S5,
S6,
S7,
S8,
S9,
S10,
S11,
S12,
S13,
S14,
S15,
S16,
S17,
S18,
S19,
S20,
S21,
S22,
S23,
S24,
S25,
S26,
S27,
S28,
S29,
S30,
S31,
// VFP Double Precision registers // VFP Double Precision registers
D0 = 0x80, D1, D2, D3, D4, D5, D6, D7, D0 = 0x80,
D8, D9, D10, D11, D12, D13, D14, D15, D1,
D16, D17, D18, D19, D20, D21, D22, D23, D2,
D24, D25, D26, D27, D28, D29, D30, D31, D3,
D4,
D5,
D6,
D7,
D8,
D9,
D10,
D11,
D12,
D13,
D14,
D15,
D16,
D17,
D18,
D19,
D20,
D21,
D22,
D23,
D24,
D25,
D26,
D27,
D28,
D29,
D30,
D31,
// ASIMD Quad-Word registers // ASIMD Quad-Word registers
Q0 = 0xC0, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q0 = 0xC0,
Q8, Q9, Q10, Q11, Q12, Q13, Q14, Q15, Q1,
Q16, Q17, Q18, Q19, Q20, Q21, Q22, Q23, Q2,
Q24, Q25, Q26, Q27, Q28, Q29, Q30, Q31, Q3,
Q4,
Q5,
Q6,
Q7,
Q8,
Q9,
Q10,
Q11,
Q12,
Q13,
Q14,
Q15,
Q16,
Q17,
Q18,
Q19,
Q20,
Q21,
Q22,
Q23,
Q24,
Q25,
Q26,
Q27,
Q28,
Q29,
Q30,
Q31,
// For PRFM(prefetch memory) encoding // For PRFM(prefetch memory) encoding
// This is encoded in the Rt register // This is encoded in the Rt register
// Data preload // Data preload
PLDL1KEEP = 0, PLDL1STRM, PLDL1KEEP = 0,
PLDL2KEEP, PLDL2STRM, PLDL1STRM,
PLDL3KEEP, PLDL3STRM, PLDL2KEEP,
PLDL2STRM,
PLDL3KEEP,
PLDL3STRM,
// Instruction preload // Instruction preload
PLIL1KEEP = 8, PLIL1STRM, PLIL1KEEP = 8,
PLIL2KEEP, PLIL2STRM, PLIL1STRM,
PLIL3KEEP, PLIL3STRM, PLIL2KEEP,
PLIL2STRM,
PLIL3KEEP,
PLIL3STRM,
// Prepare for store // Prepare for store
PLTL1KEEP = 16, PLTL1STRM, PLTL1KEEP = 16,
PLTL2KEEP, PLTL2STRM, PLTL1STRM,
PLTL3KEEP, PLTL3STRM, PLTL2KEEP,
PLTL2STRM,
PLTL3KEEP,
PLTL3STRM,
WZR = WSP, WZR = WSP,
ZR = SP, ZR = SP,
@ -81,22 +226,59 @@ enum ARM64Reg
INVALID_REG = 0xFFFFFFFF INVALID_REG = 0xFFFFFFFF
}; };
constexpr bool Is64Bit(ARM64Reg reg) { return (reg & 0x20) != 0; } constexpr bool Is64Bit(ARM64Reg reg)
constexpr bool IsSingle(ARM64Reg reg) { return (reg & 0xC0) == 0x40; } {
constexpr bool IsDouble(ARM64Reg reg) { return (reg & 0xC0) == 0x80; } return (reg & 0x20) != 0;
constexpr bool IsScalar(ARM64Reg reg) { return IsSingle(reg) || IsDouble(reg); } }
constexpr bool IsQuad(ARM64Reg reg) { return (reg & 0xC0) == 0xC0; } constexpr bool IsSingle(ARM64Reg reg)
constexpr bool IsVector(ARM64Reg reg) { return (reg & 0xC0) != 0; } {
constexpr bool IsGPR(ARM64Reg reg) { return static_cast<int>(reg) < 0x40; } return (reg & 0xC0) == 0x40;
}
constexpr bool IsDouble(ARM64Reg reg)
{
return (reg & 0xC0) == 0x80;
}
constexpr bool IsScalar(ARM64Reg reg)
{
return IsSingle(reg) || IsDouble(reg);
}
constexpr bool IsQuad(ARM64Reg reg)
{
return (reg & 0xC0) == 0xC0;
}
constexpr bool IsVector(ARM64Reg reg)
{
return (reg & 0xC0) != 0;
}
constexpr bool IsGPR(ARM64Reg reg)
{
return static_cast<int>(reg) < 0x40;
}
constexpr ARM64Reg DecodeReg(ARM64Reg reg) { return static_cast<ARM64Reg>(reg & 0x1F); } constexpr ARM64Reg DecodeReg(ARM64Reg reg)
constexpr ARM64Reg EncodeRegTo64(ARM64Reg reg) { return static_cast<ARM64Reg>(reg | 0x20); } {
constexpr ARM64Reg EncodeRegToSingle(ARM64Reg reg) { return static_cast<ARM64Reg>(DecodeReg(reg) + S0); } return static_cast<ARM64Reg>(reg & 0x1F);
constexpr ARM64Reg EncodeRegToDouble(ARM64Reg reg) { return static_cast<ARM64Reg>((reg & ~0xC0) | 0x80); } }
constexpr ARM64Reg EncodeRegToQuad(ARM64Reg reg) { return static_cast<ARM64Reg>(reg | 0xC0); } constexpr ARM64Reg EncodeRegTo64(ARM64Reg reg)
{
return static_cast<ARM64Reg>(reg | 0x20);
}
constexpr ARM64Reg EncodeRegToSingle(ARM64Reg reg)
{
return static_cast<ARM64Reg>(DecodeReg(reg) + S0);
}
constexpr ARM64Reg EncodeRegToDouble(ARM64Reg reg)
{
return static_cast<ARM64Reg>((reg & ~0xC0) | 0x80);
}
constexpr ARM64Reg EncodeRegToQuad(ARM64Reg reg)
{
return static_cast<ARM64Reg>(reg | 0xC0);
}
// For AND/TST/ORR/EOR etc // For AND/TST/ORR/EOR etc
bool IsImmLogical(uint64_t value, unsigned int width, unsigned int* n, unsigned int* imm_s, unsigned int* imm_r); bool IsImmLogical(uint64_t value, unsigned int width, unsigned int* n, unsigned int* imm_s,
unsigned int* imm_r);
// For ADD/SUB // For ADD/SUB
bool IsImmArithmetic(uint64_t input, u32* val, bool* shift); bool IsImmArithmetic(uint64_t input, u32* val, bool* shift);
@ -136,7 +318,8 @@ enum ShiftAmount
SHIFT_48 = 3, SHIFT_48 = 3,
}; };
enum RoundingMode { enum RoundingMode
{
ROUND_A, // round to nearest, ties to away ROUND_A, // round to nearest, ties to away
ROUND_M, // round towards -inf ROUND_M, // round towards -inf
ROUND_N, // round to nearest, ties to even ROUND_N, // round to nearest, ties to even
@ -293,25 +476,17 @@ public:
m_shift = 0; m_shift = 0;
} }
} }
TypeSpecifier GetType() const TypeSpecifier GetType() const { return m_type; }
{ ARM64Reg GetReg() const { return m_destReg; }
return m_type;
}
ARM64Reg GetReg() const
{
return m_destReg;
}
u32 GetData() const u32 GetData() const
{ {
switch (m_type) switch (m_type)
{ {
case TYPE_EXTENDEDREG: case TYPE_EXTENDEDREG:
return (m_extend << 13) | return (m_extend << 13) | (m_shift << 10);
(m_shift << 10);
break; break;
case TYPE_SHIFTEDREG: case TYPE_SHIFTEDREG:
return (m_shifttype << 22) | return (m_shifttype << 22) | (m_shift << 10);
(m_shift << 10);
break; break;
default: default:
_dbg_assert_msg_(DYNA_REC, false, "Invalid type in GetData"); _dbg_assert_msg_(DYNA_REC, false, "Invalid type in GetData");
@ -335,7 +510,8 @@ private:
void EncodeUnconditionalBranchInst(u32 opc, u32 op2, u32 op3, u32 op4, ARM64Reg Rn); void EncodeUnconditionalBranchInst(u32 opc, u32 op2, u32 op3, u32 op4, ARM64Reg Rn);
void EncodeExceptionInst(u32 instenc, u32 imm); void EncodeExceptionInst(u32 instenc, u32 imm);
void EncodeSystemInst(u32 op0, u32 op1, u32 CRn, u32 CRm, u32 op2, ARM64Reg Rt); void EncodeSystemInst(u32 op0, u32 op1, u32 CRn, u32 CRm, u32 op2, ARM64Reg Rt);
void EncodeArithmeticInst(u32 instenc, bool flags, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm, ArithOption Option); void EncodeArithmeticInst(u32 instenc, bool flags, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm,
ArithOption Option);
void EncodeArithmeticCarryInst(u32 op, bool flags, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm); void EncodeArithmeticCarryInst(u32 op, bool flags, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm);
void EncodeCondCompareImmInst(u32 op, ARM64Reg Rn, u32 imm, u32 nzcv, CCFlags cond); void EncodeCondCompareImmInst(u32 op, ARM64Reg Rn, u32 imm, u32 nzcv, CCFlags cond);
void EncodeCondCompareRegInst(u32 op, ARM64Reg Rn, ARM64Reg Rm, u32 nzcv, CCFlags cond); void EncodeCondCompareRegInst(u32 op, ARM64Reg Rn, ARM64Reg Rm, u32 nzcv, CCFlags cond);
@ -354,7 +530,8 @@ private:
void EncodeLoadStoreRegisterOffset(u32 size, u32 opc, ARM64Reg Rt, ARM64Reg Rn, ArithOption Rm); void EncodeLoadStoreRegisterOffset(u32 size, u32 opc, ARM64Reg Rt, ARM64Reg Rn, ArithOption Rm);
void EncodeAddSubImmInst(u32 op, bool flags, u32 shift, u32 imm, ARM64Reg Rn, ARM64Reg Rd); void EncodeAddSubImmInst(u32 op, bool flags, u32 shift, u32 imm, ARM64Reg Rn, ARM64Reg Rd);
void EncodeLogicalImmInst(u32 op, ARM64Reg Rd, ARM64Reg Rn, u32 immr, u32 imms, int n); void EncodeLogicalImmInst(u32 op, ARM64Reg Rd, ARM64Reg Rn, u32 immr, u32 imms, int n);
void EncodeLoadStorePair(u32 op, u32 load, IndexType type, ARM64Reg Rt, ARM64Reg Rt2, ARM64Reg Rn, s32 imm); void EncodeLoadStorePair(u32 op, u32 load, IndexType type, ARM64Reg Rt, ARM64Reg Rt2, ARM64Reg Rn,
s32 imm);
void EncodeAddressInst(u32 op, ARM64Reg Rd, s32 imm); void EncodeAddressInst(u32 op, ARM64Reg Rd, s32 imm);
void EncodeLoadStoreUnscaled(u32 size, u32 op, ARM64Reg Rt, ARM64Reg Rn, s32 imm); void EncodeLoadStoreUnscaled(u32 size, u32 op, ARM64Reg Rt, ARM64Reg Rn, s32 imm);
@ -362,20 +539,14 @@ protected:
void Write32(u32 value); void Write32(u32 value);
public: public:
ARM64XEmitter() ARM64XEmitter() : m_code(nullptr), m_lastCacheFlushEnd(nullptr) {}
: m_code(nullptr), m_lastCacheFlushEnd(nullptr) ARM64XEmitter(u8* code_ptr)
{ {
}
ARM64XEmitter(u8* code_ptr) {
m_code = code_ptr; m_code = code_ptr;
m_lastCacheFlushEnd = code_ptr; m_lastCacheFlushEnd = code_ptr;
} }
virtual ~ARM64XEmitter() virtual ~ARM64XEmitter() {}
{
}
void SetCodePtr(u8* ptr); void SetCodePtr(u8* ptr);
void SetCodePtrUnsafe(u8* ptr); void SetCodePtrUnsafe(u8* ptr);
void ReserveCodeSpace(u32 bytes); void ReserveCodeSpace(u32 bytes);
@ -480,11 +651,7 @@ public:
ARM64Reg zr = Is64Bit(Rd) ? ZR : WZR; ARM64Reg zr = Is64Bit(Rd) ? ZR : WZR;
CSINC(Rd, zr, zr, (CCFlags)((u32)cond ^ 1)); CSINC(Rd, zr, zr, (CCFlags)((u32)cond ^ 1));
} }
void NEG(ARM64Reg Rd, ARM64Reg Rs) void NEG(ARM64Reg Rd, ARM64Reg Rs) { SUB(Rd, Is64Bit(Rd) ? ZR : WZR, Rs); }
{
SUB(Rd, Is64Bit(Rd) ? ZR : WZR, Rs);
}
// Data-Processing 1 source // Data-Processing 1 source
void RBIT(ARM64Reg Rd, ARM64Reg Rn); void RBIT(ARM64Reg Rd, ARM64Reg Rn);
void REV16(ARM64Reg Rd, ARM64Reg Rn); void REV16(ARM64Reg Rd, ARM64Reg Rn);
@ -542,7 +709,6 @@ public:
void EON(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm) { EON(Rd, Rn, Rm, ArithOption(Rd, ST_LSL, 0)); } void EON(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm) { EON(Rd, Rn, Rm, ArithOption(Rd, ST_LSL, 0)); }
void ANDS(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm) { ANDS(Rd, Rn, Rm, ArithOption(Rd, ST_LSL, 0)); } void ANDS(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm) { ANDS(Rd, Rn, Rm, ArithOption(Rd, ST_LSL, 0)); }
void BICS(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm) { BICS(Rd, Rn, Rm, ArithOption(Rd, ST_LSL, 0)); } void BICS(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm) { BICS(Rd, Rn, Rm, ArithOption(Rd, ST_LSL, 0)); }
// Convenience wrappers around ORR. These match the official convenience syntax. // Convenience wrappers around ORR. These match the official convenience syntax.
void MOV(ARM64Reg Rd, ARM64Reg Rm, ArithOption Shift); void MOV(ARM64Reg Rd, ARM64Reg Rm, ArithOption Shift);
void MOV(ARM64Reg Rd, ARM64Reg Rm); void MOV(ARM64Reg Rd, ARM64Reg Rm);
@ -560,11 +726,7 @@ public:
void EOR(ARM64Reg Rd, ARM64Reg Rn, u32 immr, u32 imms, bool invert = false); void EOR(ARM64Reg Rd, ARM64Reg Rn, u32 immr, u32 imms, bool invert = false);
void ORR(ARM64Reg Rd, ARM64Reg Rn, u32 immr, u32 imms, bool invert = false); void ORR(ARM64Reg Rd, ARM64Reg Rn, u32 immr, u32 imms, bool invert = false);
void TST(ARM64Reg Rn, u32 immr, u32 imms, bool invert = false); void TST(ARM64Reg Rn, u32 immr, u32 imms, bool invert = false);
void TST(ARM64Reg Rn, ARM64Reg Rm) void TST(ARM64Reg Rn, ARM64Reg Rm) { ANDS(Is64Bit(Rn) ? ZR : WZR, Rn, Rm); }
{
ANDS(Is64Bit(Rn) ? ZR : WZR, Rn, Rm);
}
// Add/subtract (immediate) // Add/subtract (immediate)
void ADD(ARM64Reg Rd, ARM64Reg Rn, u32 imm, bool shift = false); void ADD(ARM64Reg Rd, ARM64Reg Rn, u32 imm, bool shift = false);
void ADDS(ARM64Reg Rd, ARM64Reg Rn, u32 imm, bool shift = false); void ADDS(ARM64Reg Rd, ARM64Reg Rn, u32 imm, bool shift = false);
@ -594,11 +756,7 @@ public:
void UXTB(ARM64Reg Rd, ARM64Reg Rn); void UXTB(ARM64Reg Rd, ARM64Reg Rn);
void UXTH(ARM64Reg Rd, ARM64Reg Rn); void UXTH(ARM64Reg Rd, ARM64Reg Rn);
void UBFX(ARM64Reg Rd, ARM64Reg Rn, int lsb, int width) void UBFX(ARM64Reg Rd, ARM64Reg Rn, int lsb, int width) { UBFM(Rd, Rn, lsb, lsb + width - 1); }
{
UBFM(Rd, Rn, lsb, lsb + width - 1);
}
// Load Register (Literal) // Load Register (Literal)
void LDR(ARM64Reg Rt, u32 imm); void LDR(ARM64Reg Rt, u32 imm);
void LDRSW(ARM64Reg Rt, u32 imm); void LDRSW(ARM64Reg Rt, u32 imm);
@ -684,10 +842,14 @@ public:
MOVI2R(Rd, (uintptr_t)ptr); MOVI2R(Rd, (uintptr_t)ptr);
} }
// Wrapper around AND x, y, imm etc. If you are sure the imm will work, no need to pass a scratch register. // Wrapper around AND x, y, imm etc. If you are sure the imm will work, no need to pass a scratch
// register.
void ANDI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch = INVALID_REG); void ANDI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch = INVALID_REG);
void ANDSI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch = INVALID_REG); void ANDSI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch = INVALID_REG);
void TSTI2R(ARM64Reg Rn, u64 imm, ARM64Reg scratch = INVALID_REG) { ANDSI2R(Is64Bit(Rn) ? ZR : WZR, Rn, imm, scratch); } void TSTI2R(ARM64Reg Rn, u64 imm, ARM64Reg scratch = INVALID_REG)
{
ANDSI2R(Is64Bit(Rn) ? ZR : WZR, Rn, imm, scratch);
}
void ORRI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch = INVALID_REG); void ORRI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch = INVALID_REG);
void EORI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch = INVALID_REG); void EORI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch = INVALID_REG);
void CMPI2R(ARM64Reg Rn, u64 imm, ARM64Reg scratch = INVALID_REG); void CMPI2R(ARM64Reg Rn, u64 imm, ARM64Reg scratch = INVALID_REG);
@ -726,13 +888,14 @@ public:
{ {
auto trampoline = &ARM64XEmitter::CallLambdaTrampoline<T, Args...>; auto trampoline = &ARM64XEmitter::CallLambdaTrampoline<T, Args...>;
MOVI2R(X30, (uintptr_t)trampoline); MOVI2R(X30, (uintptr_t)trampoline);
MOVI2R(X0, (uintptr_t)const_cast<void*>((const void*)f)); MOVI2R(X0, (uintptr_t) const_cast<void*>((const void*)f));
return X30; return X30;
} }
// Plain function call // Plain function call
void QuickCallFunction(ARM64Reg scratchreg, const void* func); void QuickCallFunction(ARM64Reg scratchreg, const void* func);
template <typename T> void QuickCallFunction(ARM64Reg scratchreg, T func) template <typename T>
void QuickCallFunction(ARM64Reg scratchreg, T func)
{ {
QuickCallFunction(scratchreg, (const void*)func); QuickCallFunction(scratchreg, (const void*)func);
} }
@ -742,7 +905,6 @@ class ARM64FloatEmitter
{ {
public: public:
ARM64FloatEmitter(ARM64XEmitter* emit) : m_emit(emit) {} ARM64FloatEmitter(ARM64XEmitter* emit) : m_emit(emit) {}
void LDR(u8 size, IndexType type, ARM64Reg Rt, ARM64Reg Rn, s32 imm); void LDR(u8 size, IndexType type, ARM64Reg Rt, ARM64Reg Rn, s32 imm);
void STR(u8 size, IndexType type, ARM64Reg Rt, ARM64Reg Rn, s32 imm); void STR(u8 size, IndexType type, ARM64Reg Rt, ARM64Reg Rn, s32 imm);
@ -823,10 +985,7 @@ public:
void FSUB(u8 size, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm); void FSUB(u8 size, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm);
void NOT(ARM64Reg Rd, ARM64Reg Rn); void NOT(ARM64Reg Rd, ARM64Reg Rn);
void ORR(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm); void ORR(ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm);
void MOV(ARM64Reg Rd, ARM64Reg Rn) void MOV(ARM64Reg Rd, ARM64Reg Rn) { ORR(Rd, Rn, Rn); }
{
ORR(Rd, Rn, Rn);
}
void REV16(u8 size, ARM64Reg Rd, ARM64Reg Rn); void REV16(u8 size, ARM64Reg Rd, ARM64Reg Rn);
void REV32(u8 size, ARM64Reg Rd, ARM64Reg Rn); void REV32(u8 size, ARM64Reg Rd, ARM64Reg Rn);
void REV64(u8 size, ARM64Reg Rd, ARM64Reg Rn); void REV64(u8 size, ARM64Reg Rd, ARM64Reg Rn);
@ -852,7 +1011,8 @@ public:
void FCVT(u8 size_to, u8 size_from, ARM64Reg Rd, ARM64Reg Rn); void FCVT(u8 size_to, u8 size_from, ARM64Reg Rd, ARM64Reg Rn);
// Scalar convert float to int, in a lot of variants. // Scalar convert float to int, in a lot of variants.
// Note that the scalar version of this operation has two encodings, one that goes to an integer register // Note that the scalar version of this operation has two encodings, one that goes to an integer
// register
// and one that outputs to a scalar fp register. // and one that outputs to a scalar fp register.
void FCVTS(ARM64Reg Rd, ARM64Reg Rn, RoundingMode round); void FCVTS(ARM64Reg Rd, ARM64Reg Rn, RoundingMode round);
void FCVTU(ARM64Reg Rd, ARM64Reg Rn, RoundingMode round); void FCVTU(ARM64Reg Rd, ARM64Reg Rn, RoundingMode round);
@ -920,18 +1080,21 @@ public:
private: private:
ARM64XEmitter* m_emit; ARM64XEmitter* m_emit;
inline void Write32(u32 value) { m_emit->Write32(value); } inline void Write32(u32 value) { m_emit->Write32(value); }
// Emitting functions // Emitting functions
void EmitLoadStoreImmediate(u8 size, u32 opc, IndexType type, ARM64Reg Rt, ARM64Reg Rn, s32 imm); void EmitLoadStoreImmediate(u8 size, u32 opc, IndexType type, ARM64Reg Rt, ARM64Reg Rn, s32 imm);
void EmitScalar2Source(bool M, bool S, u32 type, u32 opcode, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm); void EmitScalar2Source(bool M, bool S, u32 type, u32 opcode, ARM64Reg Rd, ARM64Reg Rn,
ARM64Reg Rm);
void EmitThreeSame(bool U, u32 size, u32 opcode, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm); void EmitThreeSame(bool U, u32 size, u32 opcode, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm);
void EmitCopy(bool Q, u32 op, u32 imm5, u32 imm4, ARM64Reg Rd, ARM64Reg Rn); void EmitCopy(bool Q, u32 op, u32 imm5, u32 imm4, ARM64Reg Rd, ARM64Reg Rn);
void Emit2RegMisc(bool Q, bool U, u32 size, u32 opcode, ARM64Reg Rd, ARM64Reg Rn); void Emit2RegMisc(bool Q, bool U, u32 size, u32 opcode, ARM64Reg Rd, ARM64Reg Rn);
void EmitLoadStoreSingleStructure(bool L, bool R, u32 opcode, bool S, u32 size, ARM64Reg Rt, ARM64Reg Rn); void EmitLoadStoreSingleStructure(bool L, bool R, u32 opcode, bool S, u32 size, ARM64Reg Rt,
void EmitLoadStoreSingleStructure(bool L, bool R, u32 opcode, bool S, u32 size, ARM64Reg Rt, ARM64Reg Rn, ARM64Reg Rm); ARM64Reg Rn);
void EmitLoadStoreSingleStructure(bool L, bool R, u32 opcode, bool S, u32 size, ARM64Reg Rt,
ARM64Reg Rn, ARM64Reg Rm);
void Emit1Source(bool M, bool S, u32 type, u32 opcode, ARM64Reg Rd, ARM64Reg Rn); void Emit1Source(bool M, bool S, u32 type, u32 opcode, ARM64Reg Rd, ARM64Reg Rn);
void EmitConversion(bool sf, bool S, u32 type, u32 rmode, u32 opcode, ARM64Reg Rd, ARM64Reg Rn); void EmitConversion(bool sf, bool S, u32 type, u32 rmode, u32 opcode, ARM64Reg Rd, ARM64Reg Rn);
void EmitConversion2(bool sf, bool S, bool direction, u32 type, u32 rmode, u32 opcode, int scale, ARM64Reg Rd, ARM64Reg Rn); void EmitConversion2(bool sf, bool S, bool direction, u32 type, u32 rmode, u32 opcode, int scale,
ARM64Reg Rd, ARM64Reg Rn);
void EmitCompare(bool M, bool S, u32 op, u32 opcode2, ARM64Reg Rn, ARM64Reg Rm); void EmitCompare(bool M, bool S, u32 op, u32 opcode2, ARM64Reg Rn, ARM64Reg Rm);
void EmitCondSelect(bool M, bool S, CCFlags cond, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm); void EmitCondSelect(bool M, bool S, CCFlags cond, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm);
void EmitPermute(u32 size, u32 op, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm); void EmitPermute(u32 size, u32 op, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm);
@ -939,13 +1102,17 @@ private:
void EmitShiftImm(bool Q, bool U, u32 immh, u32 immb, u32 opcode, ARM64Reg Rd, ARM64Reg Rn); void EmitShiftImm(bool Q, bool U, u32 immh, u32 immb, u32 opcode, ARM64Reg Rd, ARM64Reg Rn);
void EmitScalarShiftImm(bool U, u32 immh, u32 immb, u32 opcode, ARM64Reg Rd, ARM64Reg Rn); void EmitScalarShiftImm(bool U, u32 immh, u32 immb, u32 opcode, ARM64Reg Rd, ARM64Reg Rn);
void EmitLoadStoreMultipleStructure(u32 size, bool L, u32 opcode, ARM64Reg Rt, ARM64Reg Rn); void EmitLoadStoreMultipleStructure(u32 size, bool L, u32 opcode, ARM64Reg Rt, ARM64Reg Rn);
void EmitLoadStoreMultipleStructurePost(u32 size, bool L, u32 opcode, ARM64Reg Rt, ARM64Reg Rn, ARM64Reg Rm); void EmitLoadStoreMultipleStructurePost(u32 size, bool L, u32 opcode, ARM64Reg Rt, ARM64Reg Rn,
ARM64Reg Rm);
void EmitScalar1Source(bool M, bool S, u32 type, u32 opcode, ARM64Reg Rd, ARM64Reg Rn); void EmitScalar1Source(bool M, bool S, u32 type, u32 opcode, ARM64Reg Rd, ARM64Reg Rn);
void EmitVectorxElement(bool U, u32 size, bool L, u32 opcode, bool H, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm); void EmitVectorxElement(bool U, u32 size, bool L, u32 opcode, bool H, ARM64Reg Rd, ARM64Reg Rn,
ARM64Reg Rm);
void EmitLoadStoreUnscaled(u32 size, u32 op, ARM64Reg Rt, ARM64Reg Rn, s32 imm); void EmitLoadStoreUnscaled(u32 size, u32 op, ARM64Reg Rt, ARM64Reg Rn, s32 imm);
void EmitConvertScalarToInt(ARM64Reg Rd, ARM64Reg Rn, RoundingMode round, bool sign); void EmitConvertScalarToInt(ARM64Reg Rd, ARM64Reg Rn, RoundingMode round, bool sign);
void EmitScalar3Source(bool isDouble, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm, ARM64Reg Ra, int opcode); void EmitScalar3Source(bool isDouble, ARM64Reg Rd, ARM64Reg Rn, ARM64Reg Rm, ARM64Reg Ra,
void EncodeLoadStorePair(u32 size, bool load, IndexType type, ARM64Reg Rt, ARM64Reg Rt2, ARM64Reg Rn, s32 imm); int opcode);
void EncodeLoadStorePair(u32 size, bool load, IndexType type, ARM64Reg Rt, ARM64Reg Rt2,
ARM64Reg Rn, s32 imm);
void EncodeLoadStoreRegisterOffset(u32 size, bool load, ARM64Reg Rt, ARM64Reg Rn, ArithOption Rm); void EncodeLoadStoreRegisterOffset(u32 size, bool load, ARM64Reg Rt, ARM64Reg Rn, ArithOption Rm);
void EncodeModImm(bool Q, u8 op, u8 cmode, u8 o2, ARM64Reg Rd, u8 abcdefgh); void EncodeModImm(bool Q, u8 op, u8 cmode, u8 o2, ARM64Reg Rd, u8 abcdefgh);
@ -963,7 +1130,8 @@ private:
{ {
u32* ptr = (u32*)region; u32* ptr = (u32*)region;
u32* maxptr = (u32*)(region + region_size); u32* maxptr = (u32*)(region + region_size);
// If our memory isn't a multiple of u32 then this won't write the last remaining bytes with anything // If our memory isn't a multiple of u32 then this won't write the last remaining bytes with
// anything
// Less than optimal, but there would be nothing we could do but throw a runtime warning anyway. // Less than optimal, but there would be nothing we could do but throw a runtime warning anyway.
// AArch64: 0xD4200000 = BRK 0 // AArch64: 0xD4200000 = BRK 0
while (ptr < maxptr) while (ptr < maxptr)
@ -971,4 +1139,3 @@ private:
} }
}; };
} }

View File

@ -2,15 +2,15 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
#include <asm/hwcap.h>
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
#include <string> #include <string>
#include <unistd.h>
#include <asm/hwcap.h>
#include <sys/auxv.h> #include <sys/auxv.h>
#include <unistd.h>
#include "Common/CommonTypes.h"
#include "Common/CPUDetect.h" #include "Common/CPUDetect.h"
#include "Common/CommonTypes.h"
#include "Common/StringUtil.h" #include "Common/StringUtil.h"
const char procfile[] = "/proc/cpuinfo"; const char procfile[] = "/proc/cpuinfo";
@ -78,11 +78,16 @@ std::string CPUInfo::Summarize()
else else
sum = StringFromFormat("%s, %i cores", cpu_string, num_cores); sum = StringFromFormat("%s, %i cores", cpu_string, num_cores);
if (bAES) sum += ", AES"; if (bAES)
if (bCRC32) sum += ", CRC32"; sum += ", AES";
if (bSHA1) sum += ", SHA1"; if (bCRC32)
if (bSHA2) sum += ", SHA2"; sum += ", CRC32";
if (CPU64bit) sum += ", 64-bit"; if (bSHA1)
sum += ", SHA1";
if (bSHA2)
sum += ", SHA2";
if (CPU64bit)
sum += ", 64-bit";
return sum; return sum;
} }

View File

@ -25,4 +25,3 @@ enum CCFlags
CC_LO = CC_CC, // Alias of CC_CC Unsigned lower CC_LO = CC_CC, // Alias of CC_CC Unsigned lower
}; };
const u32 NO_COND = 0xE0000000; const u32 NO_COND = 0xE0000000;

View File

@ -6,31 +6,35 @@
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/CommonFuncs.h" #include "Common/CommonFuncs.h"
#include "Common/MsgHandler.h"
#include "Common/Logging/Log.h" #include "Common/Logging/Log.h"
#include "Common/MsgHandler.h"
#ifdef _WIN32 #ifdef _WIN32
#define _assert_msg_(_t_, _a_, _fmt_, ...) \ #define _assert_msg_(_t_, _a_, _fmt_, ...) \
if (!(_a_)) {\ if (!(_a_)) \
{ \
if (!PanicYesNo(_fmt_, __VA_ARGS__)) \ if (!PanicYesNo(_fmt_, __VA_ARGS__)) \
Crash(); \ Crash(); \
} }
#define _dbg_assert_msg_(_t_, _a_, _msg_, ...)\ #define _dbg_assert_msg_(_t_, _a_, _msg_, ...) \
if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG && !(_a_)) {\ if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG && !(_a_)) \
{ \
ERROR_LOG(_t_, _msg_, __VA_ARGS__); \ ERROR_LOG(_t_, _msg_, __VA_ARGS__); \
if (!PanicYesNo(_msg_, __VA_ARGS__)) \ if (!PanicYesNo(_msg_, __VA_ARGS__)) \
Crash(); \ Crash(); \
} }
#else #else
#define _assert_msg_(_t_, _a_, _fmt_, ...) \ #define _assert_msg_(_t_, _a_, _fmt_, ...) \
if (!(_a_)) {\ if (!(_a_)) \
{ \
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) \ if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) \
Crash(); \ Crash(); \
} }
#define _dbg_assert_msg_(_t_, _a_, _msg_, ...)\ #define _dbg_assert_msg_(_t_, _a_, _msg_, ...) \
if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG && !(_a_)) {\ if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG && !(_a_)) \
{ \
ERROR_LOG(_t_, _msg_, ##__VA_ARGS__); \ ERROR_LOG(_t_, _msg_, ##__VA_ARGS__); \
if (!PanicYesNo(_msg_, ##__VA_ARGS__)) \ if (!PanicYesNo(_msg_, ##__VA_ARGS__)) \
Crash(); \ Crash(); \

View File

@ -25,7 +25,6 @@
namespace Common namespace Common
{ {
inline void AtomicAdd(volatile u32& target, u32 value) inline void AtomicAdd(volatile u32& target, u32 value)
{ {
__sync_add_and_fetch(&target, value); __sync_add_and_fetch(&target, value);
@ -84,5 +83,4 @@ inline T* AtomicExchangeAcquire(T* volatile& loc, U newval)
{ {
return __atomic_exchange_n(&loc, newval, __ATOMIC_ACQ_REL); return __atomic_exchange_n(&loc, newval, __ATOMIC_ACQ_REL);
} }
} }

View File

@ -31,7 +31,6 @@
namespace Common namespace Common
{ {
inline void AtomicAdd(volatile u32& target, u32 value) inline void AtomicAdd(volatile u32& target, u32 value)
{ {
_InterlockedExchangeAdd((volatile LONG*)&target, (LONG)value); _InterlockedExchangeAdd((volatile LONG*)&target, (LONG)value);
@ -74,20 +73,19 @@ inline T AtomicLoadAcquire(volatile T& src)
template <typename T, typename U> template <typename T, typename U>
inline void AtomicStore(volatile T& dest, U value) inline void AtomicStore(volatile T& dest, U value)
{ {
dest = (T) value; // 32-bit writes are always atomic. dest = (T)value; // 32-bit writes are always atomic.
} }
template <typename T, typename U> template <typename T, typename U>
inline void AtomicStoreRelease(volatile T& dest, U value) inline void AtomicStoreRelease(volatile T& dest, U value)
{ {
_WriteBarrier(); // Compiler instruction only. x86 stores always have release semantics. _WriteBarrier(); // Compiler instruction only. x86 stores always have release semantics.
dest = (T) value; // 32-bit writes are always atomic. dest = (T)value; // 32-bit writes are always atomic.
} }
template <typename T, typename U> template <typename T, typename U>
inline T* AtomicExchangeAcquire(T* volatile& loc, U newval) inline T* AtomicExchangeAcquire(T* volatile& loc, U newval)
{ {
return (T*) _InterlockedExchangePointer_acq((void* volatile*) &loc, (void*) newval); return (T*)_InterlockedExchangePointer_acq((void* volatile*)&loc, (void*)newval);
} }
} }

View File

@ -2,7 +2,6 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
// Copyright 2014 Tony Wasserka // Copyright 2014 Tony Wasserka
// All rights reserved. // All rights reserved.
// //
@ -30,7 +29,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#pragma once #pragma once
#include <limits> #include <limits>
@ -111,7 +109,7 @@
* symptoms. * symptoms.
*/ */
#pragma pack(1) #pragma pack(1)
template<std::size_t position, std::size_t bits, typename T> template <std::size_t position, std::size_t bits, typename T>
struct BitField struct BitField
{ {
private: private:
@ -154,19 +152,14 @@ public:
} }
} }
__forceinline operator T() const __forceinline operator T() const { return Value(); }
{
return Value();
}
private: private:
// StorageType is T for non-enum types and the underlying type of T if // StorageType is T for non-enum types and the underlying type of T if
// T is an enumeration. Note that T is wrapped within an enable_if in the // T is an enumeration. Note that T is wrapped within an enable_if in the
// former case to workaround compile errors which arise when using // former case to workaround compile errors which arise when using
// std::underlying_type<T>::type directly. // std::underlying_type<T>::type directly.
typedef typename std::conditional<std::is_enum<T>::value, typedef typename std::conditional<std::is_enum<T>::value, std::underlying_type<T>,
std::underlying_type<T>, std::enable_if<true, T>>::type::type StorageType;
std::enable_if<true,T>>::type::type StorageType;
// Unsigned version of StorageType // Unsigned version of StorageType
typedef typename std::make_unsigned<StorageType>::type StorageTypeU; typedef typename std::make_unsigned<StorageType>::type StorageTypeU;

View File

@ -19,10 +19,10 @@ static inline int CountSetBits(T v)
// from https://graphics.stanford.edu/~seander/bithacks.html // from https://graphics.stanford.edu/~seander/bithacks.html
// GCC has this built in, but MSVC's intrinsic will only emit the actual // GCC has this built in, but MSVC's intrinsic will only emit the actual
// POPCNT instruction, which we're not depending on // POPCNT instruction, which we're not depending on
v = v - ((v >> 1) & (T)~(T)0/3); v = v - ((v >> 1) & (T) ~(T)0 / 3);
v = (v & (T)~(T)0/15*3) + ((v >> 2) & (T)~(T)0/15*3); v = (v & (T) ~(T)0 / 15 * 3) + ((v >> 2) & (T) ~(T)0 / 15 * 3);
v = (v + (v >> 4)) & (T)~(T)0/255*15; v = (v + (v >> 4)) & (T) ~(T)0 / 255 * 15;
return (T)(v * ((T)~(T)0/255)) >> (sizeof(T) - 1) * 8; return (T)(v * ((T) ~(T)0 / 255)) >> (sizeof(T) - 1) * 8;
} }
static inline int LeastSignificantSetBit(u8 val) static inline int LeastSignificantSetBit(u8 val)
{ {
@ -49,20 +49,43 @@ static inline int LeastSignificantSetBit(u64 val)
return (int)index; return (int)index;
} }
#else #else
static inline int CountSetBits(u8 val) { return __builtin_popcount(val); } static inline int CountSetBits(u8 val)
static inline int CountSetBits(u16 val) { return __builtin_popcount(val); } {
static inline int CountSetBits(u32 val) { return __builtin_popcount(val); } return __builtin_popcount(val);
static inline int CountSetBits(u64 val) { return __builtin_popcountll(val); } }
static inline int LeastSignificantSetBit(u8 val) { return __builtin_ctz(val); } static inline int CountSetBits(u16 val)
static inline int LeastSignificantSetBit(u16 val) { return __builtin_ctz(val); } {
static inline int LeastSignificantSetBit(u32 val) { return __builtin_ctz(val); } return __builtin_popcount(val);
static inline int LeastSignificantSetBit(u64 val) { return __builtin_ctzll(val); } }
static inline int CountSetBits(u32 val)
{
return __builtin_popcount(val);
}
static inline int CountSetBits(u64 val)
{
return __builtin_popcountll(val);
}
static inline int LeastSignificantSetBit(u8 val)
{
return __builtin_ctz(val);
}
static inline int LeastSignificantSetBit(u16 val)
{
return __builtin_ctz(val);
}
static inline int LeastSignificantSetBit(u32 val)
{
return __builtin_ctz(val);
}
static inline int LeastSignificantSetBit(u64 val)
{
return __builtin_ctzll(val);
}
#endif #endif
// namespace avoids conflict with OS X Carbon; don't use BitSet<T> directly // namespace avoids conflict with OS X Carbon; don't use BitSet<T> directly
namespace BS namespace BS
{ {
// Similar to std::bitset, this is a class which encapsulates a bitset, i.e. // Similar to std::bitset, this is a class which encapsulates a bitset, i.e.
// using the set bits of an integer to represent a set of integers. Like that // using the set bits of an integer to represent a set of integers. Like that
// class, it acts like an array of bools: // class, it acts like an array of bools:
@ -87,6 +110,7 @@ template <typename IntTy>
class BitSet class BitSet
{ {
static_assert(!std::is_signed<IntTy>::value, "BitSet should not be used with signed types"); static_assert(!std::is_signed<IntTy>::value, "BitSet should not be used with signed types");
public: public:
// A reference to a particular bit, returned from operator[]. // A reference to a particular bit, returned from operator[].
class Ref class Ref
@ -100,6 +124,7 @@ public:
m_bs->m_val = (m_bs->m_val & ~m_mask) | (set ? m_mask : 0); m_bs->m_val = (m_bs->m_val & ~m_mask) | (set ? m_mask : 0);
return set; return set;
} }
private: private:
BitSet* m_bs; BitSet* m_bs;
IntTy m_mask; IntTy m_mask;
@ -111,7 +136,11 @@ public:
public: public:
Iterator(const Iterator& other) : m_val(other.m_val), m_bit(other.m_bit) {} Iterator(const Iterator& other) : m_val(other.m_val), m_bit(other.m_bit) {}
Iterator(IntTy val, int bit) : m_val(val), m_bit(bit) {} Iterator(IntTy val, int bit) : m_val(val), m_bit(bit) {}
Iterator& operator=(Iterator other) { new (this) Iterator(other); return *this; } Iterator& operator=(Iterator other)
{
new (this) Iterator(other);
return *this;
}
int operator*() { return m_bit; } int operator*() { return m_bit; }
Iterator& operator++() Iterator& operator++()
{ {
@ -151,7 +180,7 @@ public:
static BitSet AllTrue(size_t count) static BitSet AllTrue(size_t count)
{ {
return BitSet(count == sizeof(IntTy)*8 ? ~(IntTy)0 : (((IntTy)1 << count) - 1)); return BitSet(count == sizeof(IntTy) * 8 ? ~(IntTy)0 : (((IntTy)1 << count) - 1));
} }
Ref operator[](size_t bit) { return Ref(this, (IntTy)1 << bit); } Ref operator[](size_t bit) { return Ref(this, (IntTy)1 << bit); }
@ -168,19 +197,19 @@ public:
BitSet& operator&=(BitSet other) { return *this = *this & other; } BitSet& operator&=(BitSet other) { return *this = *this & other; }
BitSet& operator^=(BitSet other) { return *this = *this ^ other; } BitSet& operator^=(BitSet other) { return *this = *this ^ other; }
explicit operator bool() const { return m_val != 0; } explicit operator bool() const { return m_val != 0; }
// Warning: Even though on modern CPUs this is a single fast instruction, // Warning: Even though on modern CPUs this is a single fast instruction,
// Dolphin's official builds do not currently assume POPCNT support on x86, // Dolphin's official builds do not currently assume POPCNT support on x86,
// so slower explicit bit twiddling is generated. Still should generally // so slower explicit bit twiddling is generated. Still should generally
// be faster than a loop. // be faster than a loop.
unsigned int Count() const { return CountSetBits(m_val); } unsigned int Count() const { return CountSetBits(m_val); }
Iterator begin() const
Iterator begin() const { Iterator it(m_val, 0); return ++it; } {
Iterator it(m_val, 0);
return ++it;
}
Iterator end() const { return Iterator(m_val, -1); } Iterator end() const { return Iterator(m_val, -1); }
IntTy m_val; IntTy m_val;
}; };
} }
typedef BS::BitSet<u8> BitSet8; typedef BS::BitSet<u8> BitSet8;

View File

@ -13,24 +13,17 @@
namespace Common namespace Common
{ {
// This class provides a synchronized loop. // This class provides a synchronized loop.
// It's a thread-safe way to trigger a new iteration without busy loops. // It's a thread-safe way to trigger a new iteration without busy loops.
// It's optimized for high-usage iterations which usually are already running while it's triggered often. // It's optimized for high-usage iterations which usually are already running while it's triggered
// Be careful when using Wait() and Wakeup() at the same time. Wait() may block forever while Wakeup() is called regularly. // often.
// Be careful when using Wait() and Wakeup() at the same time. Wait() may block forever while
// Wakeup() is called regularly.
class BlockingLoop class BlockingLoop
{ {
public: public:
BlockingLoop() BlockingLoop() { m_stopped.Set(); }
{ ~BlockingLoop() { Stop(); }
m_stopped.Set();
}
~BlockingLoop()
{
Stop();
}
// Triggers to rerun the payload of the Run() function at least once again. // Triggers to rerun the payload of the Run() function at least once again.
// This function will never block and is designed to finish as fast as possible. // This function will never block and is designed to finish as fast as possible.
void Wakeup() void Wakeup()
@ -75,7 +68,8 @@ public:
// Half start the worker. // Half start the worker.
// So this object is in a running state and Wait() will block until the worker calls Run(). // So this object is in a running state and Wait() will block until the worker calls Run().
// This may be called from any thread and is supposed to be called at least once before Wait() is used. // This may be called from any thread and is supposed to be called at least once before Wait() is
// used.
void Prepare() void Prepare()
{ {
// There is a race condition if the other threads call this function while // There is a race condition if the other threads call this function while
@ -84,16 +78,19 @@ public:
if (!m_stopped.TestAndClear()) if (!m_stopped.TestAndClear())
return; return;
m_running_state.store(STATE_LAST_EXECUTION); // so the payload will only be executed once without any Wakeup call m_running_state.store(
STATE_LAST_EXECUTION); // so the payload will only be executed once without any Wakeup call
m_shutdown.Clear(); m_shutdown.Clear();
m_may_sleep.Set(); m_may_sleep.Set();
} }
// Main loop of this object. // Main loop of this object.
// The payload callback is called at least as often as it's needed to match the Wakeup() requirements. // The payload callback is called at least as often as it's needed to match the Wakeup()
// requirements.
// The optional timeout parameter is a timeout for how periodically the payload should be called. // The optional timeout parameter is a timeout for how periodically the payload should be called.
// Use timeout = 0 to run without a timeout at all. // Use timeout = 0 to run without a timeout at all.
template<class F> void Run(F payload, int64_t timeout = 0) template <class F>
void Run(F payload, int64_t timeout = 0)
{ {
// Asserts that Prepare is called at least once before we enter the loop. // Asserts that Prepare is called at least once before we enter the loop.
// But a good implementation should call this before already. // But a good implementation should call this before already.
@ -106,14 +103,17 @@ public:
switch (m_running_state.load()) switch (m_running_state.load())
{ {
case STATE_NEED_EXECUTION: case STATE_NEED_EXECUTION:
// We won't get notified while we are in the STATE_NEED_EXECUTION state, so maybe Wakeup was called. // We won't get notified while we are in the STATE_NEED_EXECUTION state, so maybe Wakeup was
// So we have to assume on finishing the STATE_NEED_EXECUTION state, that there may be some remaining tasks. // called.
// So we have to assume on finishing the STATE_NEED_EXECUTION state, that there may be some
// remaining tasks.
// To process this tasks, we call the payload again within the STATE_LAST_EXECUTION state. // To process this tasks, we call the payload again within the STATE_LAST_EXECUTION state.
m_running_state--; m_running_state--;
break; break;
case STATE_LAST_EXECUTION: case STATE_LAST_EXECUTION:
// If we're still in the STATE_LAST_EXECUTION state, then Wakeup wasn't called within the last // If we're still in the STATE_LAST_EXECUTION state, then Wakeup wasn't called within the
// last
// execution of the payload. This means we should be ready now. // execution of the payload. This means we should be ready now.
// But bad luck, Wakeup may have been called right now. So break and rerun the payload // But bad luck, Wakeup may have been called right now. So break and rerun the payload
// if the state was touched. // if the state was touched.
@ -126,7 +126,8 @@ public:
m_done_event.Set(); m_done_event.Set();
case STATE_DONE: case STATE_DONE:
// We're done now. So time to check if we want to sleep or if we want to stay in a busy loop. // We're done now. So time to check if we want to sleep or if we want to stay in a busy
// loop.
if (m_may_sleep.TestAndClear()) if (m_may_sleep.TestAndClear())
{ {
// Try to set the sleeping state. // Try to set the sleeping state.
@ -178,23 +179,11 @@ public:
Wait(); Wait();
} }
bool IsRunning() const bool IsRunning() const { return !m_stopped.IsSet() && !m_shutdown.IsSet(); }
{ bool IsDone() const { return m_stopped.IsSet() || m_running_state.load() <= STATE_DONE; }
return !m_stopped.IsSet() && !m_shutdown.IsSet();
}
bool IsDone() const
{
return m_stopped.IsSet() || m_running_state.load() <= STATE_DONE;
}
// This function should be triggered regularly over time so // This function should be triggered regularly over time so
// that we will fall back from the busy loop to sleeping. // that we will fall back from the busy loop to sleeping.
void AllowSleep() void AllowSleep() { m_may_sleep.Set(); }
{
m_may_sleep.Set();
}
private: private:
std::mutex m_wait_lock; std::mutex m_wait_lock;
std::mutex m_prepare_lock; std::mutex m_prepare_lock;
@ -205,7 +194,8 @@ private:
Event m_new_work_event; Event m_new_work_event;
Event m_done_event; Event m_done_event;
enum RUNNING_TYPE { enum RUNNING_TYPE
{
STATE_SLEEPING = 0, STATE_SLEEPING = 0,
STATE_DONE = 1, STATE_DONE = 1,
STATE_LAST_EXECUTION = 2, STATE_LAST_EXECUTION = 2,
@ -213,7 +203,7 @@ private:
}; };
std::atomic<int> m_running_state; // must be of type RUNNING_TYPE std::atomic<int> m_running_state; // must be of type RUNNING_TYPE
Flag m_may_sleep; // If this is set, we fall back from the busy loop to an event based synchronization. Flag m_may_sleep; // If this is set, we fall back from the busy loop to an event based
// synchronization.
}; };
} }

View File

@ -133,9 +133,9 @@ MemChecks::TMemChecksStr MemChecks::GetStrings() const
{ {
std::stringstream mc; std::stringstream mc;
mc << std::hex << bp.StartAddress; mc << std::hex << bp.StartAddress;
mc << " " << (bp.bRange ? bp.EndAddress : bp.StartAddress) << " " << mc << " " << (bp.bRange ? bp.EndAddress : bp.StartAddress) << " " << (bp.bRange ? "n" : "")
(bp.bRange ? "n" : "") << (bp.OnRead ? "r" : "") << << (bp.OnRead ? "r" : "") << (bp.OnWrite ? "w" : "") << (bp.Log ? "l" : "")
(bp.OnWrite ? "w" : "") << (bp.Log ? "l" : "") << (bp.Break ? "p" : ""); << (bp.Break ? "p" : "");
mcs.push_back(mc.str()); mcs.push_back(mc.str());
} }
@ -207,17 +207,16 @@ TMemCheck* MemChecks::GetMemCheck(u32 address)
return nullptr; return nullptr;
} }
bool TMemCheck::Action(DebugInterface* debug_interface, u32 iValue, u32 addr, bool write, int size, u32 pc) bool TMemCheck::Action(DebugInterface* debug_interface, u32 iValue, u32 addr, bool write, int size,
u32 pc)
{ {
if ((write && OnWrite) || (!write && OnRead)) if ((write && OnWrite) || (!write && OnRead))
{ {
if (Log) if (Log)
{ {
INFO_LOG(MEMMAP, "CHK %08x (%s) %s%i %0*x at %08x (%s)", INFO_LOG(MEMMAP, "CHK %08x (%s) %s%i %0*x at %08x (%s)", pc,
pc, debug_interface->GetDescription(pc).c_str(), debug_interface->GetDescription(pc).c_str(), write ? "Write" : "Read", size * 8,
write ? "Write" : "Read", size*8, size*2, iValue, addr, size * 2, iValue, addr, debug_interface->GetDescription(addr).c_str());
debug_interface->GetDescription(addr).c_str()
);
} }
return true; return true;
@ -225,7 +224,6 @@ bool TMemCheck::Action(DebugInterface* debug_interface, u32 iValue, u32 addr, bo
return false; return false;
} }
bool Watches::IsAddressWatch(u32 _iAddress) const bool Watches::IsAddressWatch(u32 _iAddress) const
{ {
for (const TWatch& bp : m_Watches) for (const TWatch& bp : m_Watches)

View File

@ -41,8 +41,7 @@ struct TMemCheck
u32 numHits; u32 numHits;
// returns whether to break // returns whether to break
bool Action(DebugInterface* dbg_interface, u32 _iValue, u32 addr, bool Action(DebugInterface* dbg_interface, u32 _iValue, u32 addr, bool write, int size, u32 pc);
bool write, int size, u32 pc);
}; };
struct TWatch struct TWatch
@ -60,7 +59,6 @@ public:
typedef std::vector<std::string> TBreakPointsStr; typedef std::vector<std::string> TBreakPointsStr;
const TBreakPoints& GetBreakPoints() { return m_BreakPoints; } const TBreakPoints& GetBreakPoints() { return m_BreakPoints; }
TBreakPointsStr GetStrings() const; TBreakPointsStr GetStrings() const;
void AddFromStrings(const TBreakPointsStr& bps); void AddFromStrings(const TBreakPointsStr& bps);
@ -81,7 +79,6 @@ private:
TBreakPoints m_BreakPoints; TBreakPoints m_BreakPoints;
}; };
// Memory breakpoints // Memory breakpoints
class MemChecks class MemChecks
{ {
@ -92,7 +89,6 @@ public:
TMemChecks m_MemChecks; TMemChecks m_MemChecks;
const TMemChecks& GetMemChecks() { return m_MemChecks; } const TMemChecks& GetMemChecks() { return m_MemChecks; }
TMemChecksStr GetStrings() const; TMemChecksStr GetStrings() const;
void AddFromStrings(const TMemChecksStr& mcs); void AddFromStrings(const TMemChecksStr& mcs);
@ -103,7 +99,6 @@ public:
void Remove(u32 _Address); void Remove(u32 _Address);
void Clear() { m_MemChecks.clear(); } void Clear() { m_MemChecks.clear(); }
bool HasAny() const { return !m_MemChecks.empty(); } bool HasAny() const { return !m_MemChecks.empty(); }
}; };
@ -114,7 +109,6 @@ public:
typedef std::vector<std::string> TWatchesStr; typedef std::vector<std::string> TWatchesStr;
const TWatches& GetWatches() { return m_Watches; } const TWatches& GetWatches() { return m_Watches; }
TWatchesStr GetStrings() const; TWatchesStr GetStrings() const;
void AddFromStrings(const TWatchesStr& bps); void AddFromStrings(const TWatchesStr& bps);

View File

@ -25,8 +25,8 @@
#include <paths.h> #include <paths.h>
#else #else
#include <fcntl.h> #include <fcntl.h>
#include <sys/stat.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
#endif // WIN32 #endif // WIN32
@ -61,7 +61,9 @@ std::vector<std::string> cdio_get_devices()
} }
// advance to next drive // advance to next drive
while (*drive++) {} while (*drive++)
{
}
} }
} }
return drives; return drives;
@ -85,11 +87,9 @@ std::vector<std::string> cdio_get_devices()
if (classes_to_match == nullptr) if (classes_to_match == nullptr)
return drives; return drives;
CFDictionarySetValue(classes_to_match, CFDictionarySetValue(classes_to_match, CFSTR(kIOMediaEjectableKey), kCFBooleanTrue);
CFSTR(kIOMediaEjectableKey), kCFBooleanTrue);
kern_result = IOServiceGetMatchingServices(master_port, kern_result = IOServiceGetMatchingServices(master_port, classes_to_match, &media_iterator);
classes_to_match, &media_iterator);
if (kern_result != KERN_SUCCESS) if (kern_result != KERN_SUCCESS)
return drives; return drives;
@ -101,9 +101,7 @@ std::vector<std::string> cdio_get_devices()
do do
{ {
str_bsd_path = str_bsd_path =
IORegistryEntryCreateCFProperty(next_media, IORegistryEntryCreateCFProperty(next_media, CFSTR(kIOBSDNameKey), kCFAllocatorDefault, 0);
CFSTR(kIOBSDNameKey), kCFAllocatorDefault,
0);
if (str_bsd_path == nullptr) if (str_bsd_path == nullptr)
{ {
IOObjectRelease(next_media); IOObjectRelease(next_media);
@ -139,20 +137,15 @@ static struct
const char* format; const char* format;
unsigned int num_min; unsigned int num_min;
unsigned int num_max; unsigned int num_max;
} checklist[] = } checklist[] = {
{
#ifdef __linux__ #ifdef __linux__
{ "/dev/cdrom", 0, 0 }, {"/dev/cdrom", 0, 0}, {"/dev/dvd", 0, 0}, {"/dev/hd%c", 'a', 'z'},
{ "/dev/dvd", 0, 0 }, {"/dev/scd%d", 0, 27}, {"/dev/sr%d", 0, 27},
{ "/dev/hd%c", 'a', 'z' },
{ "/dev/scd%d", 0, 27 },
{ "/dev/sr%d", 0, 27 },
#else #else
{ "/dev/acd%d", 0, 27 }, {"/dev/acd%d", 0, 27},
{ "/dev/cd%d", 0, 27 }, {"/dev/cd%d", 0, 27},
#endif #endif
{ nullptr, 0, 0 } {nullptr, 0, 0}};
};
// Returns true if a device is a block or char device and not a symbolic link // Returns true if a device is a block or char device and not a symbolic link
static bool is_device(const std::string& source_name) static bool is_device(const std::string& source_name)
@ -161,8 +154,7 @@ static bool is_device(const std::string& source_name)
if (0 != lstat(source_name.c_str(), &buf)) if (0 != lstat(source_name.c_str(), &buf))
return false; return false;
return ((S_ISBLK(buf.st_mode) || S_ISCHR(buf.st_mode)) && return ((S_ISBLK(buf.st_mode) || S_ISCHR(buf.st_mode)) && !S_ISLNK(buf.st_mode));
!S_ISLNK(buf.st_mode));
} }
// Check a device to see if it is a DVD/CD-ROM drive // Check a device to see if it is a DVD/CD-ROM drive

View File

@ -2,7 +2,6 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
// Detect the CPU, so we'll know which optimizations to use // Detect the CPU, so we'll know which optimizations to use
#pragma once #pragma once

View File

@ -34,11 +34,14 @@
// ewww // ewww
#ifndef __has_feature #ifndef __has_feature
#define __has_feature(x) (0) #define __has_feature(x) (0)
#endif #endif
#if (__has_feature(is_trivially_copyable) && (defined(_LIBCPP_VERSION) || defined(__GLIBCXX__))) || (defined(__GNUC__) && __GNUC__ >= 5) #if (__has_feature(is_trivially_copyable) && \
#define IsTriviallyCopyable(T) std::is_trivially_copyable<typename std::remove_volatile<T>::type>::value (defined(_LIBCPP_VERSION) || defined(__GLIBCXX__))) || \
(defined(__GNUC__) && __GNUC__ >= 5)
#define IsTriviallyCopyable(T) \
std::is_trivially_copyable<typename std::remove_volatile<T>::type>::value
#elif __GNUC__ #elif __GNUC__
#define IsTriviallyCopyable(T) std::has_trivial_copy_constructor<T>::value #define IsTriviallyCopyable(T) std::has_trivial_copy_constructor<T>::value
#elif _MSC_VER #elif _MSC_VER
@ -48,11 +51,10 @@
#error No version of is_trivially_copyable #error No version of is_trivially_copyable
#endif #endif
template <class T> template <class T>
struct LinkedListItem : public T struct LinkedListItem : public T
{ {
LinkedListItem<T> *next; LinkedListItem<T>* next;
}; };
// Wrapper class // Wrapper class
@ -67,15 +69,13 @@ public:
MODE_VERIFY, // compare MODE_VERIFY, // compare
}; };
u8 **ptr; u8** ptr;
Mode mode; Mode mode;
public: public:
PointerWrap(u8 **ptr_, Mode mode_) : ptr(ptr_), mode(mode_) {} PointerWrap(u8** ptr_, Mode mode_) : ptr(ptr_), mode(mode_) {}
void SetMode(Mode mode_) { mode = mode_; } void SetMode(Mode mode_) { mode = mode_; }
Mode GetMode() const { return mode; } Mode GetMode() const { return mode; }
template <typename K, class V> template <typename K, class V>
void Do(std::map<K, V>& x) void Do(std::map<K, V>& x)
{ {
@ -192,7 +192,7 @@ public:
flag.Set(s); flag.Set(s);
} }
template<typename T> template <typename T>
void Do(std::atomic<T>& atomic) void Do(std::atomic<T>& atomic)
{ {
T temp = atomic.load(); T temp = atomic.load();
@ -218,7 +218,6 @@ public:
DoVoid((void*)&x, sizeof(x)); DoVoid((void*)&x, sizeof(x));
} }
void Do(bool& x) void Do(bool& x)
{ {
// bool's size can vary depending on platform, which can // bool's size can vary depending on platform, which can
@ -235,7 +234,8 @@ public:
template <typename T> template <typename T>
void DoPointer(T*& x, T* const base) void DoPointer(T*& x, T* const base)
{ {
// pointers can be more than 2^31 apart, but you're using this function wrong if you need that much range // pointers can be more than 2^31 apart, but you're using this function wrong if you need that
// much range
ptrdiff_t offset = x - base; ptrdiff_t offset = x - base;
Do(offset); Do(offset);
if (mode == MODE_READ) if (mode == MODE_READ)
@ -245,8 +245,9 @@ public:
} }
// Let's pretend std::list doesn't exist! // Let's pretend std::list doesn't exist!
template <class T, LinkedListItem<T>* (*TNew)(), void (*TFree)(LinkedListItem<T>*), void (*TDo)(PointerWrap&, T*)> template <class T, LinkedListItem<T>* (*TNew)(), void (*TFree)(LinkedListItem<T>*),
void DoLinkedList(LinkedListItem<T>*& list_start, LinkedListItem<T>** list_end=0) void (*TDo)(PointerWrap&, T*)>
void DoLinkedList(LinkedListItem<T>*& list_start, LinkedListItem<T>** list_end = 0)
{ {
LinkedListItem<T>* list_cur = list_start; LinkedListItem<T>* list_cur = list_start;
LinkedListItem<T>* prev = nullptr; LinkedListItem<T>* prev = nullptr;
@ -311,7 +312,8 @@ public:
if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber) if (mode == PointerWrap::MODE_READ && cookie != arbitraryNumber)
{ {
PanicAlertT("Error: After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting savestate load...", PanicAlertT("Error: After \"%s\", found %d (0x%X) instead of save marker %d (0x%X). Aborting "
"savestate load...",
prevName.c_str(), cookie, cookie, arbitraryNumber, arbitraryNumber); prevName.c_str(), cookie, cookie, arbitraryNumber, arbitraryNumber);
mode = PointerWrap::MODE_MEASURE; mode = PointerWrap::MODE_MEASURE;
} }
@ -329,8 +331,7 @@ private:
Do(elem); Do(elem);
} }
__forceinline __forceinline void DoVoid(void* data, u32 size)
void DoVoid(void* data, u32 size)
{ {
switch (mode) switch (mode)
{ {
@ -347,8 +348,8 @@ private:
case MODE_VERIFY: case MODE_VERIFY:
_dbg_assert_msg_(COMMON, !memcmp(data, *ptr, size), _dbg_assert_msg_(COMMON, !memcmp(data, *ptr, size),
"Savestate verification failure: buf %p != %p (size %u).\n", "Savestate verification failure: buf %p != %p (size %u).\n", data, *ptr,
data, *ptr, size); size);
break; break;
} }
@ -362,7 +363,7 @@ class CChunkFileReader
{ {
public: public:
// Load file template // Load file template
template<class T> template <class T>
static bool Load(const std::string& _rFilename, u32 _Revision, T& _class) static bool Load(const std::string& _rFilename, u32 _Revision, T& _class)
{ {
INFO_LOG(COMMON, "ChunkReader: Loading %s", _rFilename.c_str()); INFO_LOG(COMMON, "ChunkReader: Loading %s", _rFilename.c_str());
@ -397,8 +398,8 @@ public:
// Check revision // Check revision
if (header.Revision != _Revision) if (header.Revision != _Revision)
{ {
ERROR_LOG(COMMON, "ChunkReader: Wrong file revision, got %d expected %d", ERROR_LOG(COMMON, "ChunkReader: Wrong file revision, got %d expected %d", header.Revision,
header.Revision, _Revision); _Revision);
return false; return false;
} }
@ -406,8 +407,7 @@ public:
const u32 sz = (u32)(fileSize - headerSize); const u32 sz = (u32)(fileSize - headerSize);
if (header.ExpectedSize != sz) if (header.ExpectedSize != sz)
{ {
ERROR_LOG(COMMON, "ChunkReader: Bad file size, got %d expected %d", ERROR_LOG(COMMON, "ChunkReader: Bad file size, got %d expected %d", sz, header.ExpectedSize);
sz, header.ExpectedSize);
return false; return false;
} }
@ -428,7 +428,7 @@ public:
} }
// Save file template // Save file template
template<class T> template <class T>
static bool Save(const std::string& _rFilename, u32 _Revision, T& _class) static bool Save(const std::string& _rFilename, u32 _Revision, T& _class)
{ {
INFO_LOG(COMMON, "ChunkReader: Writing %s", _rFilename.c_str()); INFO_LOG(COMMON, "ChunkReader: Writing %s", _rFilename.c_str());

View File

@ -13,11 +13,13 @@
// having to prefix them with gen-> or something similar. // having to prefix them with gen-> or something similar.
// Example implementation: // Example implementation:
// class JIT : public CodeBlock<ARMXEmitter> {} // class JIT : public CodeBlock<ARMXEmitter> {}
template<class T> class CodeBlock : public T, NonCopyable template <class T>
class CodeBlock : public T, NonCopyable
{ {
private: private:
// A privately used function to set the executable RAM space to something invalid. // A privately used function to set the executable RAM space to something invalid.
// For debugging usefulness it should be used to set the RAM to a host specific breakpoint instruction // For debugging usefulness it should be used to set the RAM to a host specific breakpoint
// instruction
virtual void PoisonMemory() = 0; virtual void PoisonMemory() = 0;
protected: protected:
@ -31,12 +33,16 @@ protected:
public: public:
CodeBlock() CodeBlock()
: region(nullptr), region_size(0), parent_region_size(0), : region(nullptr), region_size(0), parent_region_size(0), m_has_child(false),
m_has_child(false), m_is_child(false), m_child(nullptr) m_is_child(false), m_child(nullptr)
{ {
} }
virtual ~CodeBlock() { if (region) FreeCodeSpace(); } virtual ~CodeBlock()
{
if (region)
FreeCodeSpace();
}
// Call this before you generate any code. // Call this before you generate any code.
void AllocCodeSpace(int size, bool need_low = true) void AllocCodeSpace(int size, bool need_low = true)
@ -68,23 +74,11 @@ public:
} }
} }
bool IsInSpace(u8* ptr) const bool IsInSpace(u8* ptr) const { return (ptr >= region) && (ptr < (region + region_size)); }
{
return (ptr >= region) && (ptr < (region + region_size));
}
// Cannot currently be undone. Will write protect the entire code region. // Cannot currently be undone. Will write protect the entire code region.
// Start over if you need to change the code (call FreeCodeSpace(), AllocCodeSpace()). // Start over if you need to change the code (call FreeCodeSpace(), AllocCodeSpace()).
void WriteProtect() void WriteProtect() { WriteProtectMemory(region, region_size, true); }
{ void ResetCodePtr() { T::SetCodePtr(region); }
WriteProtectMemory(region, region_size, true);
}
void ResetCodePtr()
{
T::SetCodePtr(region);
}
size_t GetSpaceLeft() const size_t GetSpaceLeft() const
{ {
return (m_has_child ? parent_region_size : region_size) - (T::GetCodePtr() - region); return (m_has_child ? parent_region_size : region_size) - (T::GetCodePtr() - region);

View File

@ -7,22 +7,14 @@
namespace ColorUtil namespace ColorUtil
{ {
static const int s_lut5to8[] = {0x00, 0x08, 0x10, 0x18, 0x20, 0x29, 0x31, 0x39, 0x41, 0x4A, 0x52,
0x5A, 0x62, 0x6A, 0x73, 0x7B, 0x83, 0x8B, 0x94, 0x9C, 0xA4, 0xAC,
0xB4, 0xBD, 0xC5, 0xCD, 0xD5, 0xDE, 0xE6, 0xEE, 0xF6, 0xFF};
static const int s_lut5to8[] = { static const int s_lut4to8[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x00,0x08,0x10,0x18,0x20,0x29,0x31,0x39, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF};
0x41,0x4A,0x52,0x5A,0x62,0x6A,0x73,0x7B,
0x83,0x8B,0x94,0x9C,0xA4,0xAC,0xB4,0xBD,
0xC5,0xCD,0xD5,0xDE,0xE6,0xEE,0xF6,0xFF
};
static const int s_lut4to8[] = { static const int s_lut3to8[] = {0x00, 0x24, 0x48, 0x6D, 0x91, 0xB6, 0xDA, 0xFF};
0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77,
0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF
};
static const int s_lut3to8[] = {
0x00,0x24,0x48,0x6D,0x91,0xB6,0xDA,0xFF
};
static u32 Decode5A3(u16 val) static u32 Decode5A3(u16 val)
{ {
@ -34,7 +26,7 @@ static u32 Decode5A3(u16 val)
{ {
r = s_lut5to8[(val >> 10) & 0x1f]; r = s_lut5to8[(val >> 10) & 0x1f];
g = s_lut5to8[(val >> 5) & 0x1f]; g = s_lut5to8[(val >> 5) & 0x1f];
b = s_lut5to8[(val) & 0x1f]; b = s_lut5to8[(val)&0x1f];
a = 0xFF; a = 0xFF;
} }
else else
@ -42,7 +34,7 @@ static u32 Decode5A3(u16 val)
a = s_lut3to8[(val >> 12) & 0x7]; a = s_lut3to8[(val >> 12) & 0x7];
r = (s_lut4to8[(val >> 8) & 0xf] * a + (bg_color & 0xFF) * (255 - a)) / 255; r = (s_lut4to8[(val >> 8) & 0xf] * a + (bg_color & 0xFF) * (255 - a)) / 255;
g = (s_lut4to8[(val >> 4) & 0xf] * a + ((bg_color >> 8) & 0xFF) * (255 - a)) / 255; g = (s_lut4to8[(val >> 4) & 0xf] * a + ((bg_color >> 8) & 0xFF) * (255 - a)) / 255;
b = (s_lut4to8[(val) & 0xf] * a + ((bg_color >> 16) & 0xFF) * (255 - a)) / 255; b = (s_lut4to8[(val)&0xf] * a + ((bg_color >> 16) & 0xFF) * (255 - a)) / 255;
a = 0xFF; a = 0xFF;
} }
return (a << 24) | (r << 16) | (g << 8) | b; return (a << 24) | (r << 16) | (g << 8) | b;
@ -74,7 +66,7 @@ void decodeCI8image(u32* dst, u8* src, u16* pal, int width, int height)
{ {
for (int iy = 0; iy < 4; iy++, src += 8) for (int iy = 0; iy < 4; iy++, src += 8)
{ {
u32* tdst = dst+(y+iy)*width+x; u32* tdst = dst + (y + iy) * width + x;
for (int ix = 0; ix < 8; ix++) for (int ix = 0; ix < 8; ix++)
{ {
// huh, this seems wrong. CI8, not 5A3, no? // huh, this seems wrong. CI8, not 5A3, no?

View File

@ -8,7 +8,6 @@
namespace ColorUtil namespace ColorUtil
{ {
void decode5A3image(u32* dst, u16* src, int width, int height); void decode5A3image(u32* dst, u16* src, int width, int height);
void decodeCI8image(u32* dst, u8* src, u16* pal, int width, int height); void decodeCI8image(u32* dst, u8* src, u16* pal, int width, int height);

View File

@ -35,25 +35,32 @@ extern const std::string scm_distributor_str;
#if defined _WIN32 #if defined _WIN32
// Memory leak checks // Memory leak checks
#define CHECK_HEAP_INTEGRITY() #define CHECK_HEAP_INTEGRITY()
// Since they are always around on Windows // Since they are always around on Windows
#define HAVE_WX 1 #define HAVE_WX 1
#define HAVE_OPENAL 1 #define HAVE_OPENAL 1
#define HAVE_PORTAUDIO 1 #define HAVE_PORTAUDIO 1
// Debug definitions // Debug definitions
#if defined(_DEBUG) #if defined(_DEBUG)
#include <crtdbg.h> #include <crtdbg.h>
#undef CHECK_HEAP_INTEGRITY #undef CHECK_HEAP_INTEGRITY
#define CHECK_HEAP_INTEGRITY() {if (!_CrtCheckMemory()) PanicAlert("memory corruption detected. see log.");} #define CHECK_HEAP_INTEGRITY() \
// If you want to see how much a pain in the ass singletons are, for example: { \
// {614} normal block at 0x030C5310, 188 bytes long. if (!_CrtCheckMemory()) \
// Data: <Master Log > 4D 61 73 74 65 72 20 4C 6F 67 00 00 00 00 00 00 PanicAlert("memory corruption detected. see log."); \
struct CrtDebugBreak { CrtDebugBreak(int spot) { _CrtSetBreakAlloc(spot); } }; }
//CrtDebugBreak breakAt(614); // If you want to see how much a pain in the ass singletons are, for example:
#endif // end DEBUG/FAST // {614} normal block at 0x030C5310, 188 bytes long.
// Data: <Master Log > 4D 61 73 74 65 72 20 4C 6F 67 00 00 00 00 00 00
struct CrtDebugBreak
{
CrtDebugBreak(int spot) { _CrtSetBreakAlloc(spot); }
};
// CrtDebugBreak breakAt(614);
#endif // end DEBUG/FAST
#endif #endif

View File

@ -19,11 +19,11 @@ constexpr size_t ArraySize(T (&arr)[N])
return N; return N;
} }
#define b2(x) ( (x) | ( (x) >> 1) ) #define b2(x) ((x) | ((x) >> 1))
#define b4(x) ( b2(x) | ( b2(x) >> 2) ) #define b4(x) (b2(x) | (b2(x) >> 2))
#define b8(x) ( b4(x) | ( b4(x) >> 4) ) #define b8(x) (b4(x) | (b4(x) >> 4))
#define b16(x) ( b8(x) | ( b8(x) >> 8) ) #define b16(x) (b8(x) | (b8(x) >> 8))
#define b32(x) (b16(x) | (b16(x) >>16) ) #define b32(x) (b16(x) | (b16(x) >> 16))
#define ROUND_UP_POW2(x) (b32(x - 1) + 1) #define ROUND_UP_POW2(x) (b32(x - 1) + 1)
#ifndef _WIN32 #ifndef _WIN32
@ -36,7 +36,10 @@ constexpr size_t ArraySize(T (&arr)[N])
#endif #endif
// go to debugger mode // go to debugger mode
#define Crash() { __builtin_trap(); } #define Crash() \
{ \
__builtin_trap(); \
}
// GCC 4.8 defines all the rotate functions now // GCC 4.8 defines all the rotate functions now
// Small issue with GCC's lrotl/lrotr intrinsics is they are still 32bit while we require 64bit // Small issue with GCC's lrotl/lrotr intrinsics is they are still 32bit while we require 64bit
@ -44,14 +47,16 @@ constexpr size_t ArraySize(T (&arr)[N])
inline u32 _rotl(u32 x, int shift) inline u32 _rotl(u32 x, int shift)
{ {
shift &= 31; shift &= 31;
if (!shift) return x; if (!shift)
return x;
return (x << shift) | (x >> (32 - shift)); return (x << shift) | (x >> (32 - shift));
} }
inline u32 _rotr(u32 x, int shift) inline u32 _rotr(u32 x, int shift)
{ {
shift &= 31; shift &= 31;
if (!shift) return x; if (!shift)
return x;
return (x >> shift) | (x << (32 - shift)); return (x >> shift) | (x << (32 - shift));
} }
#endif #endif
@ -70,24 +75,26 @@ inline u64 _rotr64(u64 x, unsigned int shift)
#else // WIN32 #else // WIN32
// Function Cross-Compatibility // Function Cross-Compatibility
#define strcasecmp _stricmp #define strcasecmp _stricmp
#define strncasecmp _strnicmp #define strncasecmp _strnicmp
#define unlink _unlink #define unlink _unlink
#define vscprintf _vscprintf #define vscprintf _vscprintf
// 64 bit offsets for Windows // 64 bit offsets for Windows
#define fseeko _fseeki64 #define fseeko _fseeki64
#define ftello _ftelli64 #define ftello _ftelli64
#define atoll _atoi64 #define atoll _atoi64
#define stat64 _stat64 #define stat64 _stat64
#define fstat64 _fstat64 #define fstat64 _fstat64
#define fileno _fileno #define fileno _fileno
extern "C" extern "C" {
{ __declspec(dllimport) void __stdcall DebugBreak(void);
__declspec(dllimport) void __stdcall DebugBreak(void);
} }
#define Crash() {DebugBreak();} #define Crash() \
{ \
DebugBreak(); \
}
#endif // WIN32 ndef #endif // WIN32 ndef
// Generic function to get last error message. // Generic function to get last error message.
@ -98,8 +105,14 @@ std::string GetLastErrorMsg();
namespace Common namespace Common
{ {
inline u8 swap8(u8 _data) {return _data;} inline u8 swap8(u8 _data)
inline u32 swap24(const u8* _data) {return (_data[0] << 16) | (_data[1] << 8) | _data[2];} {
return _data;
}
inline u32 swap24(const u8* _data)
{
return (_data[0] << 16) | (_data[1] << 8) | _data[2];
}
#ifdef ANDROID #ifdef ANDROID
#undef swap16 #undef swap16
@ -108,43 +121,95 @@ inline u32 swap24(const u8* _data) {return (_data[0] << 16) | (_data[1] << 8) |
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
inline u16 swap16(u16 _data) {return _byteswap_ushort(_data);} inline u16 swap16(u16 _data)
inline u32 swap32(u32 _data) {return _byteswap_ulong (_data);} {
inline u64 swap64(u64 _data) {return _byteswap_uint64(_data);} return _byteswap_ushort(_data);
}
inline u32 swap32(u32 _data)
{
return _byteswap_ulong(_data);
}
inline u64 swap64(u64 _data)
{
return _byteswap_uint64(_data);
}
#elif __linux__ && !(ANDROID && _M_ARM_64) #elif __linux__ && !(ANDROID && _M_ARM_64)
// Android NDK r10c has broken builtin byte swap routines // Android NDK r10c has broken builtin byte swap routines
// Disabled for now. // Disabled for now.
inline u16 swap16(u16 _data) {return bswap_16(_data);} inline u16 swap16(u16 _data)
inline u32 swap32(u32 _data) {return bswap_32(_data);} {
inline u64 swap64(u64 _data) {return bswap_64(_data);} return bswap_16(_data);
}
inline u32 swap32(u32 _data)
{
return bswap_32(_data);
}
inline u64 swap64(u64 _data)
{
return bswap_64(_data);
}
#elif __APPLE__ #elif __APPLE__
inline __attribute__((always_inline)) u16 swap16(u16 _data) inline __attribute__((always_inline)) u16 swap16(u16 _data)
{return OSSwapInt16(_data);} {
return OSSwapInt16(_data);
}
inline __attribute__((always_inline)) u32 swap32(u32 _data) inline __attribute__((always_inline)) u32 swap32(u32 _data)
{return OSSwapInt32(_data);} {
return OSSwapInt32(_data);
}
inline __attribute__((always_inline)) u64 swap64(u64 _data) inline __attribute__((always_inline)) u64 swap64(u64 _data)
{return OSSwapInt64(_data);} {
return OSSwapInt64(_data);
}
#elif __FreeBSD__ #elif __FreeBSD__
inline u16 swap16(u16 _data) {return bswap16(_data);} inline u16 swap16(u16 _data)
inline u32 swap32(u32 _data) {return bswap32(_data);} {
inline u64 swap64(u64 _data) {return bswap64(_data);} return bswap16(_data);
}
inline u32 swap32(u32 _data)
{
return bswap32(_data);
}
inline u64 swap64(u64 _data)
{
return bswap64(_data);
}
#else #else
// Slow generic implementation. // Slow generic implementation.
inline u16 swap16(u16 data) {return (data >> 8) | (data << 8);} inline u16 swap16(u16 data)
inline u32 swap32(u32 data) {return (swap16(data) << 16) | swap16(data >> 16);} {
inline u64 swap64(u64 data) {return ((u64)swap32(data) << 32) | swap32(data >> 32);} return (data >> 8) | (data << 8);
}
inline u32 swap32(u32 data)
{
return (swap16(data) << 16) | swap16(data >> 16);
}
inline u64 swap64(u64 data)
{
return ((u64)swap32(data) << 32) | swap32(data >> 32);
}
#endif #endif
inline u16 swap16(const u8* _pData) {return swap16(*(const u16*)_pData);} inline u16 swap16(const u8* _pData)
inline u32 swap32(const u8* _pData) {return swap32(*(const u32*)_pData);} {
inline u64 swap64(const u8* _pData) {return swap64(*(const u64*)_pData);} return swap16(*(const u16*)_pData);
}
inline u32 swap32(const u8* _pData)
{
return swap32(*(const u32*)_pData);
}
inline u64 swap64(const u8* _pData)
{
return swap64(*(const u64*)_pData);
}
template <int count> template <int count>
void swap(u8*); void swap(u8*);
template <> template <>
inline void swap<1>(u8* data) inline void swap<1>(u8* data)
{} {
}
template <> template <>
inline void swap<2>(u8* data) inline void swap<2>(u8* data)

View File

@ -11,35 +11,35 @@
// The user data dir // The user data dir
#define ROOT_DIR "." #define ROOT_DIR "."
#ifdef _WIN32 #ifdef _WIN32
#define USERDATA_DIR "User" #define USERDATA_DIR "User"
#define DOLPHIN_DATA_DIR "Dolphin" #define DOLPHIN_DATA_DIR "Dolphin"
#elif defined __APPLE__ #elif defined __APPLE__
// On OS X, USERDATA_DIR exists within the .app, but *always* reference // On OS X, USERDATA_DIR exists within the .app, but *always* reference
// the copy in Application Support instead! (Copied on first run) // the copy in Application Support instead! (Copied on first run)
// You can use the File::GetUserPath() util for this // You can use the File::GetUserPath() util for this
#define USERDATA_DIR "Contents/Resources/User" #define USERDATA_DIR "Contents/Resources/User"
#define DOLPHIN_DATA_DIR "Library/Application Support/Dolphin" #define DOLPHIN_DATA_DIR "Library/Application Support/Dolphin"
#elif defined ANDROID #elif defined ANDROID
#define USERDATA_DIR "user" #define USERDATA_DIR "user"
#define DOLPHIN_DATA_DIR "/sdcard/dolphin-emu" #define DOLPHIN_DATA_DIR "/sdcard/dolphin-emu"
#else #else
#define USERDATA_DIR "user" #define USERDATA_DIR "user"
#define DOLPHIN_DATA_DIR "dolphin-emu" #define DOLPHIN_DATA_DIR "dolphin-emu"
#endif #endif
// Shared data dirs (Sys and shared User for Linux) // Shared data dirs (Sys and shared User for Linux)
#if defined(_WIN32) || defined(LINUX_LOCAL_DEV) #if defined(_WIN32) || defined(LINUX_LOCAL_DEV)
#define SYSDATA_DIR "Sys" #define SYSDATA_DIR "Sys"
#elif defined __APPLE__ #elif defined __APPLE__
#define SYSDATA_DIR "Contents/Resources/Sys" #define SYSDATA_DIR "Contents/Resources/Sys"
#elif defined ANDROID #elif defined ANDROID
#define SYSDATA_DIR "/sdcard/dolphin-emu" #define SYSDATA_DIR "/sdcard/dolphin-emu"
#else #else
#ifdef DATA_DIR #ifdef DATA_DIR
#define SYSDATA_DIR DATA_DIR "sys" #define SYSDATA_DIR DATA_DIR "sys"
#else #else
#define SYSDATA_DIR "sys" #define SYSDATA_DIR "sys"
#endif #endif
#endif #endif
// Dirs in both User and Sys // Dirs in both User and Sys

View File

@ -2,7 +2,6 @@
// Licensed under GPLv2+ // Licensed under GPLv2+
// Refer to the license.txt file included. // Refer to the license.txt file included.
// This header contains type definitions that are shared between the Dolphin core and // This header contains type definitions that are shared between the Dolphin core and
// other parts of the code. Any definitions that are only used by the core should be // other parts of the code. Any definitions that are only used by the core should be
// placed in "Common.h" instead. // placed in "Common.h" instead.

View File

@ -22,7 +22,8 @@ int bn_compare(const u8* a, const u8* b, u32 n)
{ {
u32 i; u32 i;
for (i = 0; i < n; i++) { for (i = 0; i < n; i++)
{
if (a[i] < b[i]) if (a[i] < b[i])
return -1; return -1;
if (a[i] > b[i]) if (a[i] > b[i])
@ -39,7 +40,8 @@ void bn_sub_modulus(u8* a, const u8* N, u32 n)
u8 c; u8 c;
c = 0; c = 0;
for (i = n - 1; i < n; i--) { for (i = n - 1; i < n; i--)
{
dig = N[i] + c; dig = N[i] + c;
c = (a[i] < dig); c = (a[i] < dig);
a[i] -= dig; a[i] -= dig;
@ -53,7 +55,8 @@ void bn_add(u8* d, const u8* a, const u8* b, const u8* N, u32 n)
u8 c; u8 c;
c = 0; c = 0;
for (i = n - 1; i < n; i--) { for (i = n - 1; i < n; i--)
{
dig = a[i] + b[i] + c; dig = a[i] + b[i] + c;
c = (dig >= 0x100); c = (dig >= 0x100);
d[i] = dig; d[i] = dig;
@ -74,7 +77,8 @@ void bn_mul(u8* d, const u8* a, const u8* b, const u8* N, u32 n)
bn_zero(d, n); bn_zero(d, n);
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
for (mask = 0x80; mask != 0; mask >>= 1) { for (mask = 0x80; mask != 0; mask >>= 1)
{
bn_add(d, d, d, N, n); bn_add(d, d, d, N, n);
if ((a[i] & mask) != 0) if ((a[i] & mask) != 0)
bn_add(d, d, b, N, n); bn_add(d, d, b, N, n);
@ -88,9 +92,10 @@ void bn_exp(u8* d, const u8* a, const u8* N, u32 n, const u8* e, u32 en)
u8 mask; u8 mask;
bn_zero(d, n); bn_zero(d, n);
d[n-1] = 1; d[n - 1] = 1;
for (i = 0; i < en; i++) for (i = 0; i < en; i++)
for (mask = 0x80; mask != 0; mask >>= 1) { for (mask = 0x80; mask != 0; mask >>= 1)
{
bn_mul(t, d, d, N, n); bn_mul(t, d, d, N, n);
if ((e[i] & mask) != 0) if ((e[i] & mask) != 0)
bn_mul(d, t, a, N, n); bn_mul(d, t, a, N, n);
@ -106,7 +111,7 @@ void bn_inv(u8* d, const u8* a, const u8* N, u32 n)
bn_copy(t, N, n); bn_copy(t, N, n);
bn_zero(s, n); bn_zero(s, n);
s[n-1] = 2; s[n - 1] = 2;
bn_sub_modulus(t, s, n); bn_sub_modulus(t, s, n);
bn_exp(d, a, N, n, t, n); bn_exp(d, a, N, n, t, n);
} }

View File

@ -16,21 +16,21 @@
#include "Common/Crypto/ec.h" #include "Common/Crypto/ec.h"
// y**2 + x*y = x**3 + x + b // y**2 + x*y = x**3 + x + b
UNUSED static const u8 ec_b[30] = UNUSED static const u8 ec_b[30] = {0x00, 0x66, 0x64, 0x7e, 0xde, 0x6c, 0x33, 0x2c, 0x7f, 0x8c,
{0x00,0x66,0x64,0x7e,0xde,0x6c,0x33,0x2c,0x7f,0x8c,0x09,0x23,0xbb,0x58,0x21 0x09, 0x23, 0xbb, 0x58, 0x21, 0x3b, 0x33, 0x3b, 0x20, 0xe9,
,0x3b,0x33,0x3b,0x20,0xe9,0xce,0x42,0x81,0xfe,0x11,0x5f,0x7d,0x8f,0x90,0xad}; 0xce, 0x42, 0x81, 0xfe, 0x11, 0x5f, 0x7d, 0x8f, 0x90, 0xad};
// order of the addition group of points // order of the addition group of points
static const u8 ec_N[30] = static const u8 ec_N[30] = {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
{0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xe9, 0x74, 0xe7, 0x2f,
,0x13,0xe9,0x74,0xe7,0x2f,0x8a,0x69,0x22,0x03,0x1d,0x26,0x03,0xcf,0xe0,0xd7}; 0x8a, 0x69, 0x22, 0x03, 0x1d, 0x26, 0x03, 0xcf, 0xe0, 0xd7};
// base point // base point
static const u8 ec_G[60] = static const u8 ec_G[60] = {0x00, 0xfa, 0xc9, 0xdf, 0xcb, 0xac, 0x83, 0x13, 0xbb, 0x21, 0x39, 0xf1,
{0x00,0xfa,0xc9,0xdf,0xcb,0xac,0x83,0x13,0xbb,0x21,0x39,0xf1,0xbb,0x75,0x5f 0xbb, 0x75, 0x5f, 0xef, 0x65, 0xbc, 0x39, 0x1f, 0x8b, 0x36, 0xf8, 0xf8,
,0xef,0x65,0xbc,0x39,0x1f,0x8b,0x36,0xf8,0xf8,0xeb,0x73,0x71,0xfd,0x55,0x8b 0xeb, 0x73, 0x71, 0xfd, 0x55, 0x8b, 0x01, 0x00, 0x6a, 0x08, 0xa4, 0x19,
,0x01,0x00,0x6a,0x08,0xa4,0x19,0x03,0x35,0x06,0x78,0xe5,0x85,0x28,0xbe,0xbf 0x03, 0x35, 0x06, 0x78, 0xe5, 0x85, 0x28, 0xbe, 0xbf, 0x8a, 0x0b, 0xef,
,0x8a,0x0b,0xef,0xf8,0x67,0xa7,0xca,0x36,0x71,0x6f,0x7e,0x01,0xf8,0x10,0x52}; 0xf8, 0x67, 0xa7, 0xca, 0x36, 0x71, 0x6f, 0x7e, 0x01, 0xf8, 0x10, 0x52};
static void elt_copy(u8* d, const u8* a) static void elt_copy(u8* d, const u8* a)
{ {
@ -69,7 +69,8 @@ static void elt_mul_x(u8* d, const u8* a)
carry = a[0] & 1; carry = a[0] & 1;
x = 0; x = 0;
for (i = 0; i < 29; i++) { for (i = 0; i < 29; i++)
{
y = a[i + 1]; y = a[i + 1];
d[i] = x ^ (y >> 7); d[i] = x ^ (y >> 7);
x = y << 1; x = y << 1;
@ -88,30 +89,33 @@ static void elt_mul(u8* d, const u8* a, const u8* b)
i = 0; i = 0;
mask = 1; mask = 1;
for (n = 0; n < 233; n++) { for (n = 0; n < 233; n++)
{
elt_mul_x(d, d); elt_mul_x(d, d);
if ((a[i] & mask) != 0) if ((a[i] & mask) != 0)
elt_add(d, d, b); elt_add(d, d, b);
mask >>= 1; mask >>= 1;
if (mask == 0) { if (mask == 0)
{
mask = 0x80; mask = 0x80;
i++; i++;
} }
} }
} }
static const u8 square[16] = static const u8 square[16] = {0x00, 0x01, 0x04, 0x05, 0x10, 0x11, 0x14, 0x15,
{0x00,0x01,0x04,0x05,0x10,0x11,0x14,0x15,0x40,0x41,0x44,0x45,0x50,0x51,0x54,0x55}; 0x40, 0x41, 0x44, 0x45, 0x50, 0x51, 0x54, 0x55};
static void elt_square_to_wide(u8* d, const u8* a) static void elt_square_to_wide(u8* d, const u8* a)
{ {
u32 i; u32 i;
for (i = 0; i < 30; i++) { for (i = 0; i < 30; i++)
d[2*i] = square[a[i] >> 4]; {
d[2*i + 1] = square[a[i] & 15]; d[2 * i] = square[a[i] >> 4];
d[2 * i + 1] = square[a[i] & 15];
} }
} }
@ -120,7 +124,8 @@ static void wide_reduce(u8* d)
u32 i; u32 i;
u8 x; u8 x;
for (i = 0; i < 30; i++) { for (i = 0; i < 30; i++)
{
x = d[i]; x = d[i];
d[i + 19] ^= x >> 7; d[i + 19] ^= x >> 7;
@ -155,7 +160,8 @@ static void itoh_tsujii(u8* d, const u8* a, const u8* b, u32 j)
u8 t[30]; u8 t[30];
elt_copy(t, a); elt_copy(t, a);
while (j--) { while (j--)
{
elt_square(d, t); elt_square(d, t);
elt_copy(t, d); elt_copy(t, d);
} }
@ -184,7 +190,7 @@ static void elt_inv(u8* d, const u8* a)
UNUSED static int point_is_on_curve(u8* p) UNUSED static int point_is_on_curve(u8* p)
{ {
u8 s[30], t[30]; u8 s[30], t[30];
u8* x, *y; u8 *x, *y;
x = p; x = p;
y = p + 30; y = p + 30;
@ -213,15 +219,16 @@ static int point_is_zero(const u8* p)
static void point_double(u8* r, const u8* p) static void point_double(u8* r, const u8* p)
{ {
u8 s[30], t[30]; u8 s[30], t[30];
const u8* px, *py; const u8 *px, *py;
u8* rx, *ry; u8 *rx, *ry;
px = p; px = p;
py = p + 30; py = p + 30;
rx = r; rx = r;
ry = r + 30; ry = r + 30;
if (elt_is_zero(px)) { if (elt_is_zero(px))
{
elt_zero(rx); elt_zero(rx);
elt_zero(ry); elt_zero(ry);
@ -246,8 +253,8 @@ static void point_double(u8* r, const u8* p)
static void point_add(u8* r, const u8* p, const u8* q) static void point_add(u8* r, const u8* p, const u8* q)
{ {
u8 s[30], t[30], u[30]; u8 s[30], t[30], u[30];
const u8* px, *py, *qx, *qy; const u8 *px, *py, *qx, *qy;
u8* rx, *ry; u8 *rx, *ry;
px = p; px = p;
py = p + 30; py = p + 30;
@ -256,13 +263,15 @@ static void point_add(u8* r, const u8* p, const u8* q)
rx = r; rx = r;
ry = r + 30; ry = r + 30;
if (point_is_zero(p)) { if (point_is_zero(p))
{
elt_copy(rx, qx); elt_copy(rx, qx);
elt_copy(ry, qy); elt_copy(ry, qy);
return; return;
} }
if (point_is_zero(q)) { if (point_is_zero(q))
{
elt_copy(rx, px); elt_copy(rx, px);
elt_copy(ry, py); elt_copy(ry, py);
return; return;
@ -270,11 +279,13 @@ static void point_add(u8* r, const u8* p, const u8* q)
elt_add(u, px, qx); elt_add(u, px, qx);
if (elt_is_zero(u)) { if (elt_is_zero(u))
{
elt_add(u, py, qy); elt_add(u, py, qy);
if (elt_is_zero(u)) if (elt_is_zero(u))
point_double(r, p); point_double(r, p);
else { else
{
elt_zero(rx); elt_zero(rx);
elt_zero(ry); elt_zero(ry);
} }
@ -306,21 +317,22 @@ static void point_mul(u8* d, const u8* a, const u8* b) // a is bignum
elt_zero(d + 30); elt_zero(d + 30);
for (i = 0; i < 30; i++) for (i = 0; i < 30; i++)
for (mask = 0x80; mask != 0; mask >>= 1) { for (mask = 0x80; mask != 0; mask >>= 1)
{
point_double(d, d); point_double(d, d);
if ((a[i] & mask) != 0) if ((a[i] & mask) != 0)
point_add(d, d, b); point_add(d, d, b);
} }
} }
static void silly_random(u8 * rndArea, u8 count) static void silly_random(u8* rndArea, u8 count)
{ {
u16 i; u16 i;
srand((unsigned) (time(nullptr))); srand((unsigned)(time(nullptr)));
for (i=0;i<count;i++) for (i = 0; i < count; i++)
{ {
rndArea[i]=rand(); rndArea[i] = rand();
} }
} }
@ -331,17 +343,17 @@ void generate_ecdsa(u8* R, u8* S, const u8* k, const u8* hash)
u8 m[30]; u8 m[30];
u8 minv[30]; u8 minv[30];
u8 mG[60]; u8 mG[60];
//FILE *fp; // FILE *fp;
elt_zero(e); elt_zero(e);
memcpy(e + 10, hash, 20); memcpy(e + 10, hash, 20);
//Changing random number generator to a lame one... // Changing random number generator to a lame one...
silly_random(m, sizeof(m)); silly_random(m, sizeof(m));
//fp = fopen("/dev/random", "rb"); // fp = fopen("/dev/random", "rb");
//if (fread(m, sizeof m, 1, fp) != 1) // if (fread(m, sizeof m, 1, fp) != 1)
// fatal("reading random"); // fatal("reading random");
//fclose(fp); // fclose(fp);
m[0] = 0; m[0] = 0;
// R = (mG).x // R = (mG).x

View File

@ -11,30 +11,33 @@ class DebugInterface
{ {
protected: protected:
virtual ~DebugInterface() {} virtual ~DebugInterface() {}
public: public:
virtual std::string Disassemble(unsigned int /*address*/) { return "NODEBUGGER"; } virtual std::string Disassemble(unsigned int /*address*/) { return "NODEBUGGER"; }
virtual void GetRawMemoryString(int /*memory*/, unsigned int /*address*/, char* dest, int /*max_size*/) {strcpy(dest, "NODEBUGGER");} virtual void GetRawMemoryString(int /*memory*/, unsigned int /*address*/, char* dest,
virtual int GetInstructionSize(int /*instruction*/) {return 1;} int /*max_size*/)
virtual bool IsAlive() {return true;} {
virtual bool IsBreakpoint(unsigned int /*address*/) {return false;} strcpy(dest, "NODEBUGGER");
virtual void SetBreakpoint(unsigned int /*address*/){} }
virtual void ClearBreakpoint(unsigned int /*address*/){} virtual int GetInstructionSize(int /*instruction*/) { return 1; }
virtual bool IsAlive() { return true; }
virtual bool IsBreakpoint(unsigned int /*address*/) { return false; }
virtual void SetBreakpoint(unsigned int /*address*/) {}
virtual void ClearBreakpoint(unsigned int /*address*/) {}
virtual void ClearAllBreakpoints() {} virtual void ClearAllBreakpoints() {}
virtual void ToggleBreakpoint(unsigned int /*address*/){} virtual void ToggleBreakpoint(unsigned int /*address*/) {}
virtual void AddWatch(unsigned int /*address*/){} virtual void AddWatch(unsigned int /*address*/) {}
virtual void ClearAllMemChecks() {} virtual void ClearAllMemChecks() {}
virtual bool IsMemCheck(unsigned int /*address*/) {return false;} virtual bool IsMemCheck(unsigned int /*address*/) { return false; }
virtual void ToggleMemCheck(unsigned int /*address*/){} virtual void ToggleMemCheck(unsigned int /*address*/) {}
virtual unsigned int ReadMemory(unsigned int /*address*/){return 0;} virtual unsigned int ReadMemory(unsigned int /*address*/) { return 0; }
virtual void WriteExtraMemory(int /*memory*/, unsigned int /*value*/, unsigned int /*address*/) {} virtual void WriteExtraMemory(int /*memory*/, unsigned int /*value*/, unsigned int /*address*/) {}
virtual unsigned int ReadExtraMemory(int /*memory*/, unsigned int /*address*/){return 0;} virtual unsigned int ReadExtraMemory(int /*memory*/, unsigned int /*address*/) { return 0; }
virtual unsigned int ReadInstruction(unsigned int /*address*/){return 0;} virtual unsigned int ReadInstruction(unsigned int /*address*/) { return 0; }
virtual unsigned int GetPC() {return 0;} virtual unsigned int GetPC() { return 0; }
virtual void SetPC(unsigned int /*address*/) {} virtual void SetPC(unsigned int /*address*/) {}
virtual void Step() {} virtual void Step() {}
virtual void RunToBreakpoint() {} virtual void RunToBreakpoint() {}
virtual void InsertBLR(unsigned int /*address*/, unsigned int /*value*/) {} virtual void InsertBLR(unsigned int /*address*/, unsigned int /*value*/) {}
virtual int GetColor(unsigned int /*address*/){return 0xFFFFFFFF;} virtual int GetColor(unsigned int /*address*/) { return 0xFFFFFFFF; }
virtual std::string GetDescription(unsigned int /*address*/) = 0; virtual std::string GetDescription(unsigned int /*address*/) = 0;
}; };

View File

@ -8,7 +8,6 @@
namespace ENetUtil namespace ENetUtil
{ {
void WakeupThread(ENetHost* host) void WakeupThread(ENetHost* host)
{ {
// Send ourselves a spurious message. This is hackier than it should be. // Send ourselves a spurious message. This is hackier than it should be.
@ -32,11 +31,9 @@ int ENET_CALLBACK InterceptCallback(ENetHost* host, ENetEvent* event)
// wakeup packet received // wakeup packet received
if (host->receivedDataLength == 1 && host->receivedData[0] == 0) if (host->receivedDataLength == 1 && host->receivedData[0] == 0)
{ {
event->type = (ENetEventType) 42; event->type = (ENetEventType)42;
return 1; return 1;
} }
return 0; return 0;
} }
} }

View File

@ -8,8 +8,6 @@
namespace ENetUtil namespace ENetUtil
{ {
void WakeupThread(ENetHost* host); void WakeupThread(ENetHost* host);
int ENET_CALLBACK InterceptCallback(ENetHost* host, ENetEvent* event); int ENET_CALLBACK InterceptCallback(ENetHost* host, ENetEvent* event);
} }

View File

@ -22,8 +22,8 @@
#include "Common/Flag.h" #include "Common/Flag.h"
namespace Common { namespace Common
{
class Event final class Event final
{ {
public: public:
@ -42,18 +42,17 @@ public:
return; return;
std::unique_lock<std::mutex> lk(m_mutex); std::unique_lock<std::mutex> lk(m_mutex);
m_condvar.wait(lk, [&]{ return m_flag.TestAndClear(); }); m_condvar.wait(lk, [&] { return m_flag.TestAndClear(); });
} }
template<class Rep, class Period> template <class Rep, class Period>
bool WaitFor(const std::chrono::duration<Rep, Period>& rel_time) bool WaitFor(const std::chrono::duration<Rep, Period>& rel_time)
{ {
if (m_flag.TestAndClear()) if (m_flag.TestAndClear())
return true; return true;
std::unique_lock<std::mutex> lk(m_mutex); std::unique_lock<std::mutex> lk(m_mutex);
bool signaled = m_condvar.wait_for(lk, rel_time, bool signaled = m_condvar.wait_for(lk, rel_time, [&] { return m_flag.TestAndClear(); });
[&]{ return m_flag.TestAndClear(); });
return signaled; return signaled;
} }

View File

@ -8,29 +8,30 @@
namespace FPURoundMode namespace FPURoundMode
{ {
// TODO: MSVC currently produces broken code: // TODO: MSVC currently produces broken code:
// https://connect.microsoft.com/VisualStudio/feedback/details/828892/vc-2013-miscompilation-with-enums-and-bit-fields // https://connect.microsoft.com/VisualStudio/feedback/details/828892/vc-2013-miscompilation-with-enums-and-bit-fields
// Once that is fixed, change types in SetRoundMode(), SetSIMDMode(), and in UReg_FPSCR to 'RoundMode'. // Once that is fixed, change types in SetRoundMode(), SetSIMDMode(), and in UReg_FPSCR to
// 'RoundMode'.
enum RoundMode enum RoundMode
{ {
ROUND_NEAR = 0, ROUND_NEAR = 0,
ROUND_CHOP = 1, ROUND_CHOP = 1,
ROUND_UP = 2, ROUND_UP = 2,
ROUND_DOWN = 3 ROUND_DOWN = 3
}; };
enum PrecisionMode enum PrecisionMode
{ {
PREC_24 = 0, PREC_24 = 0,
PREC_53 = 1, PREC_53 = 1,
PREC_64 = 2 PREC_64 = 2
}; };
void SetRoundMode(int mode); void SetRoundMode(int mode);
void SetPrecisionMode(PrecisionMode mode); void SetPrecisionMode(PrecisionMode mode);
void SetSIMDMode(int rounding_mode, bool non_ieee_mode); void SetSIMDMode(int rounding_mode, bool non_ieee_mode);
/* /*
* There are two different flavors of float to int conversion: * There are two different flavors of float to int conversion:
@ -39,7 +40,7 @@ namespace FPURoundMode
* The first rounds according to the MXCSR rounding bits. * The first rounds according to the MXCSR rounding bits.
* The second one always uses round towards zero. * The second one always uses round towards zero.
*/ */
void SaveSIMDState(); void SaveSIMDState();
void LoadSIMDState(); void LoadSIMDState();
void LoadDefaultSIMDState(); void LoadDefaultSIMDState();
} }

View File

@ -15,16 +15,11 @@
namespace Common namespace Common
{ {
template <typename T, bool NeedSize = true> template <typename T, bool NeedSize = true>
class FifoQueue class FifoQueue
{ {
public: public:
FifoQueue() : m_size(0) FifoQueue() : m_size(0) { m_write_ptr = m_read_ptr = new ElementPtr(); }
{
m_write_ptr = m_read_ptr = new ElementPtr();
}
~FifoQueue() ~FifoQueue()
{ {
// this will empty out the whole queue // this will empty out the whole queue
@ -37,16 +32,8 @@ public:
return m_size.load(); return m_size.load();
} }
bool Empty() const bool Empty() const { return !m_read_ptr->next.load(); }
{ T& Front() const { return m_read_ptr->current; }
return !m_read_ptr->next.load();
}
T& Front() const
{
return m_read_ptr->current;
}
template <typename Arg> template <typename Arg>
void Push(Arg&& t) void Push(Arg&& t)
{ {
@ -104,7 +91,6 @@ private:
{ {
public: public:
ElementPtr() : next(nullptr) {} ElementPtr() : next(nullptr) {}
~ElementPtr() ~ElementPtr()
{ {
ElementPtr* next_ptr = next.load(); ElementPtr* next_ptr = next.load();
@ -121,5 +107,4 @@ private:
ElementPtr* m_read_ptr; ElementPtr* m_read_ptr;
std::atomic<u32> m_size; std::atomic<u32> m_size;
}; };
} }

View File

@ -9,7 +9,9 @@
#include "Common/FileSearch.h" #include "Common/FileSearch.h"
#include "Common/FileUtil.h" #include "Common/FileUtil.h"
static std::vector<std::string> FileSearchWithTest(const std::vector<std::string>& directories, bool recursive, std::function<bool(const File::FSTEntry &)> callback) static std::vector<std::string>
FileSearchWithTest(const std::vector<std::string>& directories, bool recursive,
std::function<bool(const File::FSTEntry&)> callback)
{ {
std::vector<std::string> result; std::vector<std::string> result;
for (const std::string& directory : directories) for (const std::string& directory : directories)
@ -32,7 +34,8 @@ static std::vector<std::string> FileSearchWithTest(const std::vector<std::string
return result; return result;
} }
std::vector<std::string> DoFileSearch(const std::vector<std::string>& exts, const std::vector<std::string>& directories, bool recursive) std::vector<std::string> DoFileSearch(const std::vector<std::string>& exts,
const std::vector<std::string>& directories, bool recursive)
{ {
bool accept_all = std::find(exts.begin(), exts.end(), "") != exts.end(); bool accept_all = std::find(exts.begin(), exts.end(), "") != exts.end();
return FileSearchWithTest(directories, recursive, [&](const File::FSTEntry& entry) { return FileSearchWithTest(directories, recursive, [&](const File::FSTEntry& entry) {
@ -41,15 +44,16 @@ std::vector<std::string> DoFileSearch(const std::vector<std::string>& exts, cons
std::string name = entry.virtualName; std::string name = entry.virtualName;
std::transform(name.begin(), name.end(), name.begin(), ::tolower); std::transform(name.begin(), name.end(), name.begin(), ::tolower);
return std::any_of(exts.begin(), exts.end(), [&](const std::string& ext) { return std::any_of(exts.begin(), exts.end(), [&](const std::string& ext) {
return name.length() >= ext.length() && name.compare(name.length() - ext.length(), ext.length(), ext) == 0; return name.length() >= ext.length() &&
name.compare(name.length() - ext.length(), ext.length(), ext) == 0;
}); });
}); });
} }
// Result includes the passed directories themselves as well as their subdirectories. // Result includes the passed directories themselves as well as their subdirectories.
std::vector<std::string> FindSubdirectories(const std::vector<std::string>& directories, bool recursive) std::vector<std::string> FindSubdirectories(const std::vector<std::string>& directories,
bool recursive)
{ {
return FileSearchWithTest(directories, true, [&](const File::FSTEntry& entry) { return FileSearchWithTest(directories, true,
return entry.isDirectory; [&](const File::FSTEntry& entry) { return entry.isDirectory; });
});
} }

View File

@ -7,5 +7,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
std::vector<std::string> DoFileSearch(const std::vector<std::string>& exts, const std::vector<std::string>& directories, bool recursive = false); std::vector<std::string> DoFileSearch(const std::vector<std::string>& exts,
std::vector<std::string> FindSubdirectories(const std::vector<std::string>& directories, bool recursive); const std::vector<std::string>& directories,
bool recursive = false);
std::vector<std::string> FindSubdirectories(const std::vector<std::string>& directories,
bool recursive);

View File

@ -9,8 +9,8 @@
#include <fcntl.h> #include <fcntl.h>
#include <limits.h> #include <limits.h>
#include <string> #include <string>
#include <vector>
#include <sys/stat.h> #include <sys/stat.h>
#include <vector>
#include "Common/Common.h" #include "Common/Common.h"
#include "Common/CommonFuncs.h" #include "Common/CommonFuncs.h"
@ -55,7 +55,6 @@
// REMEMBER: strdup considered harmful! // REMEMBER: strdup considered harmful!
namespace File namespace File
{ {
// Remove any ending forward slashes from directory paths // Remove any ending forward slashes from directory paths
// Modifies argument. // Modifies argument.
static void StripTailDirSlashes(std::string& fname) static void StripTailDirSlashes(std::string& fname)
@ -100,8 +99,8 @@ bool IsDirectory(const std::string& filename)
if (result < 0) if (result < 0)
{ {
WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s", WARN_LOG(COMMON, "IsDirectory: stat failed on %s: %s", filename.c_str(),
filename.c_str(), GetLastErrorMsg().c_str()); GetLastErrorMsg().c_str());
return false; return false;
} }
@ -132,15 +131,15 @@ bool Delete(const std::string& filename)
#ifdef _WIN32 #ifdef _WIN32
if (!DeleteFile(UTF8ToTStr(filename).c_str())) if (!DeleteFile(UTF8ToTStr(filename).c_str()))
{ {
WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", WARN_LOG(COMMON, "Delete: DeleteFile failed on %s: %s", filename.c_str(),
filename.c_str(), GetLastErrorMsg().c_str()); GetLastErrorMsg().c_str());
return false; return false;
} }
#else #else
if (unlink(filename.c_str()) == -1) if (unlink(filename.c_str()) == -1)
{ {
WARN_LOG(COMMON, "Delete: unlink failed on %s: %s", WARN_LOG(COMMON, "Delete: unlink failed on %s: %s", filename.c_str(),
filename.c_str(), GetLastErrorMsg().c_str()); GetLastErrorMsg().c_str());
return false; return false;
} }
#endif #endif
@ -218,7 +217,6 @@ bool CreateFullPath(const std::string& fullPath)
} }
} }
// Deletes a directory filename, returns true on success // Deletes a directory filename, returns true on success
bool DeleteDir(const std::string& filename) bool DeleteDir(const std::string& filename)
{ {
@ -246,14 +244,14 @@ bool DeleteDir(const std::string& filename)
// renames file srcFilename to destFilename, returns true on success // renames file srcFilename to destFilename, returns true on success
bool Rename(const std::string& srcFilename, const std::string& destFilename) bool Rename(const std::string& srcFilename, const std::string& destFilename)
{ {
INFO_LOG(COMMON, "Rename: %s --> %s", INFO_LOG(COMMON, "Rename: %s --> %s", srcFilename.c_str(), destFilename.c_str());
srcFilename.c_str(), destFilename.c_str());
#ifdef _WIN32 #ifdef _WIN32
auto sf = UTF8ToTStr(srcFilename); auto sf = UTF8ToTStr(srcFilename);
auto df = UTF8ToTStr(destFilename); auto df = UTF8ToTStr(destFilename);
// The Internet seems torn about whether ReplaceFile is atomic or not. // The Internet seems torn about whether ReplaceFile is atomic or not.
// Hopefully it's atomic enough... // Hopefully it's atomic enough...
if (ReplaceFile(df.c_str(), sf.c_str(), nullptr, REPLACEFILE_IGNORE_MERGE_ERRORS, nullptr, nullptr)) if (ReplaceFile(df.c_str(), sf.c_str(), nullptr, REPLACEFILE_IGNORE_MERGE_ERRORS, nullptr,
nullptr))
return true; return true;
// Might have failed because the destination doesn't exist. // Might have failed because the destination doesn't exist.
if (GetLastError() == ERROR_FILE_NOT_FOUND) if (GetLastError() == ERROR_FILE_NOT_FOUND)
@ -265,8 +263,8 @@ bool Rename(const std::string& srcFilename, const std::string& destFilename)
if (rename(srcFilename.c_str(), destFilename.c_str()) == 0) if (rename(srcFilename.c_str(), destFilename.c_str()) == 0)
return true; return true;
#endif #endif
ERROR_LOG(COMMON, "Rename: failed %s --> %s: %s", ERROR_LOG(COMMON, "Rename: failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(),
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str()); GetLastErrorMsg().c_str());
return false; return false;
} }
@ -308,18 +306,17 @@ bool RenameSync(const std::string& srcFilename, const std::string& destFilename)
// copies file srcFilename to destFilename, returns true on success // copies file srcFilename to destFilename, returns true on success
bool Copy(const std::string& srcFilename, const std::string& destFilename) bool Copy(const std::string& srcFilename, const std::string& destFilename)
{ {
INFO_LOG(COMMON, "Copy: %s --> %s", INFO_LOG(COMMON, "Copy: %s --> %s", srcFilename.c_str(), destFilename.c_str());
srcFilename.c_str(), destFilename.c_str());
#ifdef _WIN32 #ifdef _WIN32
if (CopyFile(UTF8ToTStr(srcFilename).c_str(), UTF8ToTStr(destFilename).c_str(), FALSE)) if (CopyFile(UTF8ToTStr(srcFilename).c_str(), UTF8ToTStr(destFilename).c_str(), FALSE))
return true; return true;
ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s", ERROR_LOG(COMMON, "Copy: failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(),
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str()); GetLastErrorMsg().c_str());
return false; return false;
#else #else
// buffer size // buffer size
#define BSIZE 1024 #define BSIZE 1024
char buffer[BSIZE]; char buffer[BSIZE];
@ -329,8 +326,8 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename)
OpenFStream(input, srcFilename, std::ifstream::in | std::ifstream::binary); OpenFStream(input, srcFilename, std::ifstream::in | std::ifstream::binary);
if (!input.is_open()) if (!input.is_open())
{ {
ERROR_LOG(COMMON, "Copy: input failed %s --> %s: %s", ERROR_LOG(COMMON, "Copy: input failed %s --> %s: %s", srcFilename.c_str(), destFilename.c_str(),
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str()); GetLastErrorMsg().c_str());
return false; return false;
} }
@ -339,8 +336,8 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename)
if (!output.IsOpen()) if (!output.IsOpen())
{ {
ERROR_LOG(COMMON, "Copy: output failed %s --> %s: %s", ERROR_LOG(COMMON, "Copy: output failed %s --> %s: %s", srcFilename.c_str(),
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str()); destFilename.c_str(), GetLastErrorMsg().c_str());
return false; return false;
} }
@ -351,18 +348,16 @@ bool Copy(const std::string& srcFilename, const std::string& destFilename)
input.read(buffer, BSIZE); input.read(buffer, BSIZE);
if (!input) if (!input)
{ {
ERROR_LOG(COMMON, ERROR_LOG(COMMON, "Copy: failed reading from source, %s --> %s: %s", srcFilename.c_str(),
"Copy: failed reading from source, %s --> %s: %s", destFilename.c_str(), GetLastErrorMsg().c_str());
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str());
return false; return false;
} }
// write output // write output
if (!output.WriteBytes(buffer, BSIZE)) if (!output.WriteBytes(buffer, BSIZE))
{ {
ERROR_LOG(COMMON, ERROR_LOG(COMMON, "Copy: failed writing to output, %s --> %s: %s", srcFilename.c_str(),
"Copy: failed writing to output, %s --> %s: %s", destFilename.c_str(), GetLastErrorMsg().c_str());
srcFilename.c_str(), destFilename.c_str(), GetLastErrorMsg().c_str());
return false; return false;
} }
} }
@ -393,13 +388,11 @@ u64 GetSize(const std::string& filename)
if (stat64(filename.c_str(), &buf) == 0) if (stat64(filename.c_str(), &buf) == 0)
#endif #endif
{ {
DEBUG_LOG(COMMON, "GetSize: %s: %lld", DEBUG_LOG(COMMON, "GetSize: %s: %lld", filename.c_str(), (long long)buf.st_size);
filename.c_str(), (long long)buf.st_size);
return buf.st_size; return buf.st_size;
} }
ERROR_LOG(COMMON, "GetSize: Stat failed %s: %s", ERROR_LOG(COMMON, "GetSize: Stat failed %s: %s", filename.c_str(), GetLastErrorMsg().c_str());
filename.c_str(), GetLastErrorMsg().c_str());
return 0; return 0;
} }
@ -409,8 +402,7 @@ u64 GetSize(const int fd)
struct stat64 buf; struct stat64 buf;
if (fstat64(fd, &buf) != 0) if (fstat64(fd, &buf) != 0)
{ {
ERROR_LOG(COMMON, "GetSize: stat failed %i: %s", ERROR_LOG(COMMON, "GetSize: stat failed %i: %s", fd, GetLastErrorMsg().c_str());
fd, GetLastErrorMsg().c_str());
return 0; return 0;
} }
return buf.st_size; return buf.st_size;
@ -423,16 +415,14 @@ u64 GetSize(FILE* f)
u64 pos = ftello(f); u64 pos = ftello(f);
if (fseeko(f, 0, SEEK_END) != 0) if (fseeko(f, 0, SEEK_END) != 0)
{ {
ERROR_LOG(COMMON, "GetSize: seek failed %p: %s", ERROR_LOG(COMMON, "GetSize: seek failed %p: %s", f, GetLastErrorMsg().c_str());
f, GetLastErrorMsg().c_str());
return 0; return 0;
} }
u64 size = ftello(f); u64 size = ftello(f);
if ((size != pos) && (fseeko(f, pos, SEEK_SET) != 0)) if ((size != pos) && (fseeko(f, pos, SEEK_SET) != 0))
{ {
ERROR_LOG(COMMON, "GetSize: seek failed %p: %s", ERROR_LOG(COMMON, "GetSize: seek failed %p: %s", f, GetLastErrorMsg().c_str());
f, GetLastErrorMsg().c_str());
return 0; return 0;
} }
@ -446,15 +436,14 @@ bool CreateEmptyFile(const std::string& filename)
if (!File::IOFile(filename, "wb")) if (!File::IOFile(filename, "wb"))
{ {
ERROR_LOG(COMMON, "CreateEmptyFile: failed %s: %s", ERROR_LOG(COMMON, "CreateEmptyFile: failed %s: %s", filename.c_str(),
filename.c_str(), GetLastErrorMsg().c_str()); GetLastErrorMsg().c_str());
return false; return false;
} }
return true; return true;
} }
// Scans the directory tree gets, starting from _Directory and adds the // Scans the directory tree gets, starting from _Directory and adds the
// results into parentEntry. Returns the number of files+directories found // results into parentEntry. Returns the number of files+directories found
FSTEntry ScanDirectoryTree(const std::string& directory, bool recursive) FSTEntry ScanDirectoryTree(const std::string& directory, bool recursive)
@ -490,7 +479,7 @@ FSTEntry ScanDirectoryTree(const std::string& directory, bool recursive)
while (!readdir_r(dirp, &dirent, &result) && result) while (!readdir_r(dirp, &dirent, &result) && result)
{ {
const std::string virtual_name(result->d_name); const std::string virtual_name(result->d_name);
#endif #endif
if (virtual_name == "." || virtual_name == "..") if (virtual_name == "." || virtual_name == "..")
continue; continue;
auto physical_name = directory + DIR_SEP + virtual_name; auto physical_name = directory + DIR_SEP + virtual_name;
@ -514,7 +503,7 @@ FSTEntry ScanDirectoryTree(const std::string& directory, bool recursive)
++parent_entry.size; ++parent_entry.size;
// Push into the tree // Push into the tree
parent_entry.children.push_back(entry); parent_entry.children.push_back(entry);
#ifdef _WIN32 #ifdef _WIN32
} while (FindNextFile(hFind, &ffd) != 0); } while (FindNextFile(hFind, &ffd) != 0);
FindClose(hFind); FindClose(hFind);
#else #else
@ -525,7 +514,6 @@ FSTEntry ScanDirectoryTree(const std::string& directory, bool recursive)
return parent_entry; return parent_entry;
} }
// Deletes the given directory and anything under it. Returns true on success. // Deletes the given directory and anything under it. Returns true on success.
bool DeleteDirRecursively(const std::string& directory) bool DeleteDirRecursively(const std::string& directory)
{ {
@ -561,8 +549,7 @@ bool DeleteDirRecursively(const std::string& directory)
// check for "." and ".." // check for "." and ".."
if (((virtualName[0] == '.') && (virtualName[1] == '\0')) || if (((virtualName[0] == '.') && (virtualName[1] == '\0')) ||
((virtualName[0] == '.') && (virtualName[1] == '.') && ((virtualName[0] == '.') && (virtualName[1] == '.') && (virtualName[2] == '\0')))
(virtualName[2] == '\0')))
continue; continue;
std::string newPath = directory + DIR_SEP_CHR + virtualName; std::string newPath = directory + DIR_SEP_CHR + virtualName;
@ -599,9 +586,12 @@ bool DeleteDirRecursively(const std::string& directory)
// Create directory and copy contents (does not overwrite existing files) // Create directory and copy contents (does not overwrite existing files)
void CopyDir(const std::string& source_path, const std::string& dest_path) void CopyDir(const std::string& source_path, const std::string& dest_path)
{ {
if (source_path == dest_path) return; if (source_path == dest_path)
if (!File::Exists(source_path)) return; return;
if (!File::Exists(dest_path)) File::CreateFullPath(dest_path); if (!File::Exists(source_path))
return;
if (!File::Exists(dest_path))
File::CreateFullPath(dest_path);
#ifdef _WIN32 #ifdef _WIN32
WIN32_FIND_DATA ffd; WIN32_FIND_DATA ffd;
@ -619,7 +609,8 @@ void CopyDir(const std::string& source_path, const std::string& dest_path)
#else #else
struct dirent dirent, *result = nullptr; struct dirent dirent, *result = nullptr;
DIR* dirp = opendir(source_path.c_str()); DIR* dirp = opendir(source_path.c_str());
if (!dirp) return; if (!dirp)
return;
while (!readdir_r(dirp, &dirent, &result) && result) while (!readdir_r(dirp, &dirent, &result) && result)
{ {
@ -633,10 +624,12 @@ void CopyDir(const std::string& source_path, const std::string& dest_path)
std::string dest = dest_path + DIR_SEP + virtualName; std::string dest = dest_path + DIR_SEP + virtualName;
if (IsDirectory(source)) if (IsDirectory(source))
{ {
if (!File::Exists(dest)) File::CreateFullPath(dest + DIR_SEP); if (!File::Exists(dest))
File::CreateFullPath(dest + DIR_SEP);
CopyDir(source, dest); CopyDir(source, dest);
} }
else if (!File::Exists(dest)) File::Copy(source, dest); else if (!File::Exists(dest))
File::Copy(source, dest);
#ifdef _WIN32 #ifdef _WIN32
} while (FindNextFile(hFind, &ffd) != 0); } while (FindNextFile(hFind, &ffd) != 0);
FindClose(hFind); FindClose(hFind);
@ -653,8 +646,7 @@ std::string GetCurrentDir()
// Get the current working directory (getcwd uses malloc) // Get the current working directory (getcwd uses malloc)
if (!(dir = __getcwd(nullptr, 0))) if (!(dir = __getcwd(nullptr, 0)))
{ {
ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", ERROR_LOG(COMMON, "GetCurrentDirectory failed: %s", GetLastErrorMsg().c_str());
GetLastErrorMsg().c_str());
return nullptr; return nullptr;
} }
std::string strDir = dir; std::string strDir = dir;
@ -758,9 +750,9 @@ std::string GetSysDirectory()
{ {
std::string sysDir; std::string sysDir;
#if defined (__APPLE__) #if defined(__APPLE__)
sysDir = GetBundleDirectory() + DIR_SEP + SYSDATA_DIR; sysDir = GetBundleDirectory() + DIR_SEP + SYSDATA_DIR;
#elif defined (_WIN32) || defined (LINUX_LOCAL_DEV) #elif defined(_WIN32) || defined(LINUX_LOCAL_DEV)
sysDir = GetExeDirectory() + DIR_SEP + SYSDATA_DIR; sysDir = GetExeDirectory() + DIR_SEP + SYSDATA_DIR;
#else #else
sysDir = SYSDATA_DIR; sysDir = SYSDATA_DIR;
@ -808,8 +800,10 @@ static void RebuildUserDirectories(unsigned int dir_index)
s_user_paths[F_GCSRAM_IDX] = s_user_paths[D_GCUSER_IDX] + GC_SRAM; s_user_paths[F_GCSRAM_IDX] = s_user_paths[D_GCUSER_IDX] + GC_SRAM;
s_user_paths[D_MEMORYWATCHER_IDX] = s_user_paths[D_USER_IDX] + MEMORYWATCHER_DIR DIR_SEP; s_user_paths[D_MEMORYWATCHER_IDX] = s_user_paths[D_USER_IDX] + MEMORYWATCHER_DIR DIR_SEP;
s_user_paths[F_MEMORYWATCHERLOCATIONS_IDX] = s_user_paths[D_MEMORYWATCHER_IDX] + MEMORYWATCHER_LOCATIONS; s_user_paths[F_MEMORYWATCHERLOCATIONS_IDX] =
s_user_paths[F_MEMORYWATCHERSOCKET_IDX] = s_user_paths[D_MEMORYWATCHER_IDX] + MEMORYWATCHER_SOCKET; s_user_paths[D_MEMORYWATCHER_IDX] + MEMORYWATCHER_LOCATIONS;
s_user_paths[F_MEMORYWATCHERSOCKET_IDX] =
s_user_paths[D_MEMORYWATCHER_IDX] + MEMORYWATCHER_SOCKET;
// The shader cache has moved to the cache directory, so remove the old one. // The shader cache has moved to the cache directory, so remove the old one.
// TODO: remove that someday. // TODO: remove that someday.
@ -900,16 +894,15 @@ bool ReadFileToString(const std::string& filename, std::string& str)
return retval; return retval;
} }
IOFile::IOFile() IOFile::IOFile() : m_file(nullptr), m_good(true)
: m_file(nullptr), m_good(true) {
{} }
IOFile::IOFile(std::FILE* file) IOFile::IOFile(std::FILE* file) : m_file(file), m_good(true)
: m_file(file), m_good(true) {
{} }
IOFile::IOFile(const std::string& filename, const char openmode[]) IOFile::IOFile(const std::string& filename, const char openmode[]) : m_file(nullptr), m_good(true)
: m_file(nullptr), m_good(true)
{ {
Open(filename, openmode); Open(filename, openmode);
} }
@ -919,8 +912,7 @@ IOFile::~IOFile()
Close(); Close();
} }
IOFile::IOFile(IOFile&& other) IOFile::IOFile(IOFile&& other) : m_file(nullptr), m_good(true)
: m_file(nullptr), m_good(true)
{ {
Swap(other); Swap(other);
} }
@ -1007,7 +999,8 @@ bool IOFile::Flush()
bool IOFile::Resize(u64 size) bool IOFile::Resize(u64 size)
{ {
if (!IsOpen() || 0 != if (!IsOpen() ||
0 !=
#ifdef _WIN32 #ifdef _WIN32
// ector: _chsize sucks, not 64-bit safe // ector: _chsize sucks, not 64-bit safe
// F|RES: changed to _chsize_s. i think it is 64-bit safe // F|RES: changed to _chsize_s. i think it is 64-bit safe

View File

@ -18,13 +18,15 @@
#endif #endif
// User directory indices for GetUserPath // User directory indices for GetUserPath
enum { enum
{
D_USER_IDX, D_USER_IDX,
D_GCUSER_IDX, D_GCUSER_IDX,
D_WIIROOT_IDX, // always points to User/Wii or global user-configured directory D_WIIROOT_IDX, // always points to User/Wii or global user-configured directory
D_SESSION_WIIROOT_IDX, // may point to minimal temporary directory for determinism D_SESSION_WIIROOT_IDX, // may point to minimal temporary directory for determinism
D_CONFIG_IDX, // global settings D_CONFIG_IDX, // global settings
D_GAMESETTINGS_IDX, // user-specified settings which override both the global and the default settings (per game) D_GAMESETTINGS_IDX, // user-specified settings which override both the global and the default
// settings (per game)
D_MAPS_IDX, D_MAPS_IDX,
D_CACHE_IDX, D_CACHE_IDX,
D_SHADERCACHE_IDX, D_SHADERCACHE_IDX,
@ -58,7 +60,6 @@ enum {
namespace File namespace File
{ {
// FileSystem tree node/ // FileSystem tree node/
struct FSTEntry struct FSTEntry
{ {
@ -206,15 +207,12 @@ public:
} }
bool IsOpen() const { return nullptr != m_file; } bool IsOpen() const { return nullptr != m_file; }
// m_good is set to false when a read, write or other function fails // m_good is set to false when a read, write or other function fails
bool IsGood() const { return m_good; } bool IsGood() const { return m_good; }
operator void*() { return m_good ? m_file : nullptr; } operator void*() { return m_good ? m_file : nullptr; }
std::FILE* ReleaseHandle(); std::FILE* ReleaseHandle();
std::FILE* GetHandle() { return m_file; } std::FILE* GetHandle() { return m_file; }
void SetHandle(std::FILE* file); void SetHandle(std::FILE* file);
bool Seek(s64 off, int origin); bool Seek(s64 off, int origin);
@ -224,10 +222,15 @@ public:
bool Flush(); bool Flush();
// clear error state // clear error state
void Clear() { m_good = true; std::clearerr(m_file); } void Clear()
{
m_good = true;
std::clearerr(m_file);
}
std::FILE* m_file; std::FILE* m_file;
bool m_good; bool m_good;
private: private:
IOFile(IOFile&); IOFile(IOFile&);
IOFile& operator=(IOFile& other); IOFile& operator=(IOFile& other);

View File

@ -23,7 +23,6 @@ class FixedSizeQueue
// Make copy constructor private for now. // Make copy constructor private for now.
FixedSizeQueue(FixedSizeQueue& other) {} FixedSizeQueue(FixedSizeQueue& other) {}
public: public:
FixedSizeQueue() FixedSizeQueue()
{ {
@ -31,11 +30,7 @@ public:
clear(); clear();
} }
~FixedSizeQueue() ~FixedSizeQueue() { delete[] storage; }
{
delete[] storage;
}
void clear() void clear()
{ {
head = 0; head = 0;
@ -69,9 +64,5 @@ public:
T& front() { return storage[head]; } T& front() { return storage[head]; }
const T& front() const { return storage[head]; } const T& front() const { return storage[head]; }
size_t size() const { return count; }
size_t size() const
{
return count;
}
}; };

View File

@ -19,8 +19,8 @@
#include <atomic> #include <atomic>
namespace Common { namespace Common
{
class Flag final class Flag final
{ {
public: public:
@ -28,33 +28,16 @@ public:
// object - it should be made explicit that a flag is *not* a normal // object - it should be made explicit that a flag is *not* a normal
// variable. // variable.
explicit Flag(bool initial_value = false) : m_val(initial_value) {} explicit Flag(bool initial_value = false) : m_val(initial_value) {}
void Set(bool val = true) { m_val.store(val); }
void Set(bool val = true) void Clear() { Set(false); }
{ bool IsSet() const { return m_val.load(); }
m_val.store(val);
}
void Clear()
{
Set(false);
}
bool IsSet() const
{
return m_val.load();
}
bool TestAndSet(bool val = true) bool TestAndSet(bool val = true)
{ {
bool expected = !val; bool expected = !val;
return m_val.compare_exchange_strong(expected, val); return m_val.compare_exchange_strong(expected, val);
} }
bool TestAndClear() bool TestAndClear() { return TestAndSet(false); }
{
return TestAndSet(false);
}
private: private:
std::atomic_bool m_val; std::atomic_bool m_val;
}; };

View File

@ -24,4 +24,3 @@
#include "Common/GL/GLExtensions/gl_common.h" #include "Common/GL/GLExtensions/gl_common.h"
#define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160 #define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160

View File

@ -23,11 +23,14 @@
#include "Common/GL/GLExtensions/gl_common.h" #include "Common/GL/GLExtensions/gl_common.h"
typedef void (APIENTRYP PFNDOLRELEASESHADERCOMPILERPROC) (void); typedef void(APIENTRYP PFNDOLRELEASESHADERCOMPILERPROC)(void);
typedef void (APIENTRYP PFNDOLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); typedef void(APIENTRYP PFNDOLSHADERBINARYPROC)(GLsizei count, const GLuint* shaders,
typedef void (APIENTRYP PFNDOLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); GLenum binaryformat, const void* binary,
typedef void (APIENTRYP PFNDOLDEPTHRANGEFPROC) (GLfloat n, GLfloat f); GLsizei length);
typedef void (APIENTRYP PFNDOLCLEARDEPTHFPROC) (GLfloat d); typedef void(APIENTRYP PFNDOLGETSHADERPRECISIONFORMATPROC)(GLenum shadertype, GLenum precisiontype,
GLint* range, GLint* precision);
typedef void(APIENTRYP PFNDOLDEPTHRANGEFPROC)(GLfloat n, GLfloat f);
typedef void(APIENTRYP PFNDOLCLEARDEPTHFPROC)(GLfloat d);
extern PFNDOLCLEARDEPTHFPROC dolClearDepthf; extern PFNDOLCLEARDEPTHFPROC dolClearDepthf;
extern PFNDOLDEPTHRANGEFPROC dolDepthRangef; extern PFNDOLDEPTHRANGEFPROC dolDepthRangef;

View File

@ -28,8 +28,9 @@
#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB #define GL_ONE_MINUS_SRC1_ALPHA 0x88FB
#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC #define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC
typedef void (APIENTRYP PFNDOLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); typedef void(APIENTRYP PFNDOLBINDFRAGDATALOCATIONINDEXEDPROC)(GLuint program, GLuint colorNumber,
typedef GLint (APIENTRYP PFNDOLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name); GLuint index, const GLchar* name);
typedef GLint(APIENTRYP PFNDOLGETFRAGDATAINDEXPROC)(GLuint program, const GLchar* name);
extern PFNDOLBINDFRAGDATALOCATIONINDEXEDPROC dolBindFragDataLocationIndexed; extern PFNDOLBINDFRAGDATALOCATIONINDEXEDPROC dolBindFragDataLocationIndexed;
extern PFNDOLGETFRAGDATAINDEXPROC dolGetFragDataIndex; extern PFNDOLGETFRAGDATAINDEXPROC dolGetFragDataIndex;

View File

@ -33,8 +33,10 @@
#define GL_BUFFER_IMMUTABLE_STORAGE 0x821F #define GL_BUFFER_IMMUTABLE_STORAGE 0x821F
#define GL_BUFFER_STORAGE_FLAGS 0x8220 #define GL_BUFFER_STORAGE_FLAGS 0x8220
typedef void (APIENTRYP PFNDOLBUFFERSTORAGEPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); typedef void(APIENTRYP PFNDOLBUFFERSTORAGEPROC)(GLenum target, GLsizeiptr size, const void* data,
typedef void (APIENTRYP PFNDOLNAMEDBUFFERSTORAGEEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags); GLbitfield flags);
typedef void(APIENTRYP PFNDOLNAMEDBUFFERSTORAGEEXTPROC)(GLuint buffer, GLsizeiptr size,
const void* data, GLbitfield flags);
extern PFNDOLBUFFERSTORAGEPROC dolBufferStorage; extern PFNDOLBUFFERSTORAGEPROC dolBufferStorage;

View File

@ -28,7 +28,7 @@
#define GL_CLIP_ORIGIN 0x935C #define GL_CLIP_ORIGIN 0x935C
#define GL_CLIP_DEPTH_MODE 0x935D #define GL_CLIP_DEPTH_MODE 0x935D
typedef void (APIENTRYP PFNDOLCLIPCONTROLPROC) (GLenum origin, GLenum depth); typedef void(APIENTRYP PFNDOLCLIPCONTROLPROC)(GLenum origin, GLenum depth);
extern PFNDOLCLIPCONTROLPROC dolClipControl; extern PFNDOLCLIPCONTROLPROC dolClipControl;

View File

@ -23,7 +23,12 @@
#include "Common/GL/GLExtensions/gl_common.h" #include "Common/GL/GLExtensions/gl_common.h"
typedef void (APIENTRYP PFNDOLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); typedef void(APIENTRYP PFNDOLCOPYIMAGESUBDATAPROC)(GLuint srcName, GLenum srcTarget, GLint srcLevel,
GLint srcX, GLint srcY, GLint srcZ,
GLuint dstName, GLenum dstTarget, GLint dstLevel,
GLint dstX, GLint dstY, GLint dstZ,
GLsizei srcWidth, GLsizei srcHeight,
GLsizei srcDepth);
extern PFNDOLCOPYIMAGESUBDATAPROC dolCopyImageSubData; extern PFNDOLCOPYIMAGESUBDATAPROC dolCopyImageSubData;

View File

@ -23,7 +23,9 @@
#include "Common/GL/GLExtensions/gl_common.h" #include "Common/GL/GLExtensions/gl_common.h"
typedef void (APIENTRYP GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); typedef void(APIENTRYP GLDEBUGPROCARB)(GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const GLchar* message,
const void* userParam);
#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242 #define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242
#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243 #define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243
#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244 #define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244
@ -47,10 +49,18 @@ typedef void (APIENTRYP GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLen
#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147 #define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147
#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148 #define GL_DEBUG_SEVERITY_LOW_ARB 0x9148
typedef void (APIENTRYP PFNDOLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); typedef void(APIENTRYP PFNDOLDEBUGMESSAGECONTROLARBPROC)(GLenum source, GLenum type,
typedef void (APIENTRYP PFNDOLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); GLenum severity, GLsizei count,
typedef void (APIENTRYP PFNDOLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const void *userParam); const GLuint* ids, GLboolean enabled);
typedef GLuint (APIENTRYP PFNDOLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); typedef void(APIENTRYP PFNDOLDEBUGMESSAGEINSERTARBPROC)(GLenum source, GLenum type, GLuint id,
GLenum severity, GLsizei length,
const GLchar* buf);
typedef void(APIENTRYP PFNDOLDEBUGMESSAGECALLBACKARBPROC)(GLDEBUGPROCARB callback,
const void* userParam);
typedef GLuint(APIENTRYP PFNDOLGETDEBUGMESSAGELOGARBPROC)(GLuint count, GLsizei bufSize,
GLenum* sources, GLenum* types,
GLuint* ids, GLenum* severities,
GLsizei* lengths, GLchar* messageLog);
extern PFNDOLDEBUGMESSAGECALLBACKARBPROC dolDebugMessageCallbackARB; extern PFNDOLDEBUGMESSAGECALLBACKARBPROC dolDebugMessageCallbackARB;
extern PFNDOLDEBUGMESSAGECONTROLARBPROC dolDebugMessageControlARB; extern PFNDOLDEBUGMESSAGECONTROLARBPROC dolDebugMessageControlARB;

View File

@ -23,10 +23,21 @@
#include "Common/GL/GLExtensions/gl_common.h" #include "Common/GL/GLExtensions/gl_common.h"
typedef void (APIENTRYP PFNDOLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); typedef void(APIENTRYP PFNDOLDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, GLsizei count, GLenum type,
typedef void (APIENTRYP PFNDOLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); const void* indices, GLint basevertex);
typedef void (APIENTRYP PFNDOLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); typedef void(APIENTRYP PFNDOLDRAWRANGEELEMENTSBASEVERTEXPROC)(GLenum mode, GLuint start, GLuint end,
typedef void (APIENTRYP PFNDOLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex); GLsizei count, GLenum type,
const void* indices,
GLint basevertex);
typedef void(APIENTRYP PFNDOLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)(GLenum mode, GLsizei count,
GLenum type, const void* indices,
GLsizei instancecount,
GLint basevertex);
typedef void(APIENTRYP PFNDOLMULTIDRAWELEMENTSBASEVERTEXPROC)(GLenum mode, const GLsizei* count,
GLenum type,
const void* const* indices,
GLsizei drawcount,
const GLint* basevertex);
extern PFNDOLDRAWELEMENTSBASEVERTEXPROC dolDrawElementsBaseVertex; extern PFNDOLDRAWELEMENTSBASEVERTEXPROC dolDrawElementsBaseVertex;
extern PFNDOLDRAWELEMENTSINSTANCEDBASEVERTEXPROC dolDrawElementsInstancedBaseVertex; extern PFNDOLDRAWELEMENTSINSTANCEDBASEVERTEXPROC dolDrawElementsInstancedBaseVertex;

View File

@ -23,26 +23,44 @@
#include "Common/GL/GLExtensions/gl_common.h" #include "Common/GL/GLExtensions/gl_common.h"
typedef void (APIENTRYP PFNDOLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); typedef void(APIENTRYP PFNDOLBINDFRAMEBUFFERPROC)(GLenum target, GLuint framebuffer);
typedef void (APIENTRYP PFNDOLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); typedef void(APIENTRYP PFNDOLBINDRENDERBUFFERPROC)(GLenum target, GLuint renderbuffer);
typedef void (APIENTRYP PFNDOLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); typedef void(APIENTRYP PFNDOLBLITFRAMEBUFFERPROC)(GLint srcX0, GLint srcY0, GLint srcX1,
typedef GLenum (APIENTRYP PFNDOLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); GLint srcY1, GLint dstX0, GLint dstY0,
typedef void (APIENTRYP PFNDOLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers); GLint dstX1, GLint dstY1, GLbitfield mask,
typedef void (APIENTRYP PFNDOLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers); GLenum filter);
typedef void (APIENTRYP PFNDOLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); typedef GLenum(APIENTRYP PFNDOLCHECKFRAMEBUFFERSTATUSPROC)(GLenum target);
typedef void (APIENTRYP PFNDOLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); typedef void(APIENTRYP PFNDOLDELETEFRAMEBUFFERSPROC)(GLsizei n, const GLuint* framebuffers);
typedef void (APIENTRYP PFNDOLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); typedef void(APIENTRYP PFNDOLDELETERENDERBUFFERSPROC)(GLsizei n, const GLuint* renderbuffers);
typedef void (APIENTRYP PFNDOLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); typedef void(APIENTRYP PFNDOLFRAMEBUFFERRENDERBUFFERPROC)(GLenum target, GLenum attachment,
typedef void (APIENTRYP PFNDOLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); GLenum renderbuffertarget,
typedef void (APIENTRYP PFNDOLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); GLuint renderbuffer);
typedef void (APIENTRYP PFNDOLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); typedef void(APIENTRYP PFNDOLFRAMEBUFFERTEXTURE1DPROC)(GLenum target, GLenum attachment,
typedef void (APIENTRYP PFNDOLGENERATEMIPMAPPROC) (GLenum target); GLenum textarget, GLuint texture,
typedef void (APIENTRYP PFNDOLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); GLint level);
typedef void (APIENTRYP PFNDOLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); typedef void(APIENTRYP PFNDOLFRAMEBUFFERTEXTURE2DPROC)(GLenum target, GLenum attachment,
typedef GLboolean (APIENTRYP PFNDOLISFRAMEBUFFERPROC) (GLuint framebuffer); GLenum textarget, GLuint texture,
typedef GLboolean (APIENTRYP PFNDOLISRENDERBUFFERPROC) (GLuint renderbuffer); GLint level);
typedef void (APIENTRYP PFNDOLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); typedef void(APIENTRYP PFNDOLFRAMEBUFFERTEXTURE3DPROC)(GLenum target, GLenum attachment,
typedef void (APIENTRYP PFNDOLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); GLenum textarget, GLuint texture,
GLint level, GLint zoffset);
typedef void(APIENTRYP PFNDOLFRAMEBUFFERTEXTURELAYERPROC)(GLenum target, GLenum attachment,
GLuint texture, GLint level, GLint layer);
typedef void(APIENTRYP PFNDOLGENFRAMEBUFFERSPROC)(GLsizei n, GLuint* framebuffers);
typedef void(APIENTRYP PFNDOLGENRENDERBUFFERSPROC)(GLsizei n, GLuint* renderbuffers);
typedef void(APIENTRYP PFNDOLGENERATEMIPMAPPROC)(GLenum target);
typedef void(APIENTRYP PFNDOLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)(GLenum target,
GLenum attachment,
GLenum pname, GLint* params);
typedef void(APIENTRYP PFNDOLGETRENDERBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname,
GLint* params);
typedef GLboolean(APIENTRYP PFNDOLISFRAMEBUFFERPROC)(GLuint framebuffer);
typedef GLboolean(APIENTRYP PFNDOLISRENDERBUFFERPROC)(GLuint renderbuffer);
typedef void(APIENTRYP PFNDOLRENDERBUFFERSTORAGEPROC)(GLenum target, GLenum internalformat,
GLsizei width, GLsizei height);
typedef void(APIENTRYP PFNDOLRENDERBUFFERSTORAGEMULTISAMPLEPROC)(GLenum target, GLsizei samples,
GLenum internalformat,
GLsizei width, GLsizei height);
extern PFNDOLBINDFRAMEBUFFERPROC dolBindFramebuffer; extern PFNDOLBINDFRAMEBUFFERPROC dolBindFramebuffer;
extern PFNDOLBINDRENDERBUFFERPROC dolBindRenderbuffer; extern PFNDOLBINDRENDERBUFFERPROC dolBindRenderbuffer;

View File

@ -28,9 +28,11 @@
#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE #define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE
#define GL_PROGRAM_BINARY_FORMATS 0x87FF #define GL_PROGRAM_BINARY_FORMATS 0x87FF
typedef void (APIENTRYP PFNDOLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); typedef void(APIENTRYP PFNDOLGETPROGRAMBINARYPROC)(GLuint program, GLsizei bufSize, GLsizei* length,
typedef void (APIENTRYP PFNDOLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); GLenum* binaryFormat, void* binary);
typedef void (APIENTRYP PFNDOLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value); typedef void(APIENTRYP PFNDOLPROGRAMBINARYPROC)(GLuint program, GLenum binaryFormat,
const void* binary, GLsizei length);
typedef void(APIENTRYP PFNDOLPROGRAMPARAMETERIPROC)(GLuint program, GLenum pname, GLint value);
extern PFNDOLGETPROGRAMBINARYPROC dolGetProgramBinary; extern PFNDOLGETPROGRAMBINARYPROC dolGetProgramBinary;
extern PFNDOLPROGRAMBINARYPROC dolProgramBinary; extern PFNDOLPROGRAMBINARYPROC dolProgramBinary;

View File

@ -23,8 +23,10 @@
#include "Common/GL/GLExtensions/gl_common.h" #include "Common/GL/GLExtensions/gl_common.h"
typedef void *(APIENTRYP PFNDOLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); typedef void*(APIENTRYP PFNDOLMAPBUFFERRANGEPROC)(GLenum target, GLintptr offset, GLsizeiptr length,
typedef void (APIENTRYP PFNDOLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length); GLbitfield access);
typedef void(APIENTRYP PFNDOLFLUSHMAPPEDBUFFERRANGEPROC)(GLenum target, GLintptr offset,
GLsizeiptr length);
extern PFNDOLFLUSHMAPPEDBUFFERRANGEPROC dolFlushMappedBufferRange; extern PFNDOLFLUSHMAPPEDBUFFERRANGEPROC dolFlushMappedBufferRange;
extern PFNDOLMAPBUFFERRANGEPROC dolMapBufferRange; extern PFNDOLMAPBUFFERRANGEPROC dolMapBufferRange;

View File

@ -23,7 +23,7 @@
#include "Common/GL/GLExtensions/gl_common.h" #include "Common/GL/GLExtensions/gl_common.h"
typedef void (APIENTRYP PFNDOLMINSAMPLESHADINGARBPROC) (GLfloat value); typedef void(APIENTRYP PFNDOLMINSAMPLESHADINGARBPROC)(GLfloat value);
extern PFNDOLMINSAMPLESHADINGARBPROC dolMinSampleShading; extern PFNDOLMINSAMPLESHADINGARBPROC dolMinSampleShading;

View File

@ -23,20 +23,28 @@
#include "Common/GL/GLExtensions/gl_common.h" #include "Common/GL/GLExtensions/gl_common.h"
typedef void (APIENTRYP PFNDOLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers); typedef void(APIENTRYP PFNDOLGENSAMPLERSPROC)(GLsizei count, GLuint* samplers);
typedef void (APIENTRYP PFNDOLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers); typedef void(APIENTRYP PFNDOLDELETESAMPLERSPROC)(GLsizei count, const GLuint* samplers);
typedef GLboolean (APIENTRYP PFNDOLISSAMPLERPROC) (GLuint sampler); typedef GLboolean(APIENTRYP PFNDOLISSAMPLERPROC)(GLuint sampler);
typedef void (APIENTRYP PFNDOLBINDSAMPLERPROC) (GLuint unit, GLuint sampler); typedef void(APIENTRYP PFNDOLBINDSAMPLERPROC)(GLuint unit, GLuint sampler);
typedef void (APIENTRYP PFNDOLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param); typedef void(APIENTRYP PFNDOLSAMPLERPARAMETERIPROC)(GLuint sampler, GLenum pname, GLint param);
typedef void (APIENTRYP PFNDOLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param); typedef void(APIENTRYP PFNDOLSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname,
typedef void (APIENTRYP PFNDOLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param); const GLint* param);
typedef void (APIENTRYP PFNDOLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param); typedef void(APIENTRYP PFNDOLSAMPLERPARAMETERFPROC)(GLuint sampler, GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNDOLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param); typedef void(APIENTRYP PFNDOLSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname,
typedef void (APIENTRYP PFNDOLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param); const GLfloat* param);
typedef void (APIENTRYP PFNDOLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params); typedef void(APIENTRYP PFNDOLSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname,
typedef void (APIENTRYP PFNDOLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params); const GLint* param);
typedef void (APIENTRYP PFNDOLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params); typedef void(APIENTRYP PFNDOLSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname,
typedef void (APIENTRYP PFNDOLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params); const GLuint* param);
typedef void(APIENTRYP PFNDOLGETSAMPLERPARAMETERIVPROC)(GLuint sampler, GLenum pname,
GLint* params);
typedef void(APIENTRYP PFNDOLGETSAMPLERPARAMETERIIVPROC)(GLuint sampler, GLenum pname,
GLint* params);
typedef void(APIENTRYP PFNDOLGETSAMPLERPARAMETERFVPROC)(GLuint sampler, GLenum pname,
GLfloat* params);
typedef void(APIENTRYP PFNDOLGETSAMPLERPARAMETERIUIVPROC)(GLuint sampler, GLenum pname,
GLuint* params);
extern PFNDOLBINDSAMPLERPROC dolBindSampler; extern PFNDOLBINDSAMPLERPROC dolBindSampler;
extern PFNDOLDELETESAMPLERSPROC dolDeleteSamplers; extern PFNDOLDELETESAMPLERSPROC dolDeleteSamplers;

View File

@ -40,7 +40,9 @@
#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE #define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE
#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF #define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF
typedef void (APIENTRY * PFNDOLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding); typedef void(APIENTRY* PFNDOLSHADERSTORAGEBLOCKBINDINGPROC)(GLuint program,
GLuint storageBlockIndex,
GLuint storageBlockBinding);
extern PFNDOLSHADERSTORAGEBLOCKBINDINGPROC dolShaderStorageBlockBinding; extern PFNDOLSHADERSTORAGEBLOCKBINDINGPROC dolShaderStorageBlockBinding;

View File

@ -23,14 +23,15 @@
#include "Common/GL/GLExtensions/gl_common.h" #include "Common/GL/GLExtensions/gl_common.h"
typedef GLsync (APIENTRYP PFNDOLFENCESYNCPROC) (GLenum condition, GLbitfield flags); typedef GLsync(APIENTRYP PFNDOLFENCESYNCPROC)(GLenum condition, GLbitfield flags);
typedef GLboolean (APIENTRYP PFNDOLISSYNCPROC) (GLsync sync); typedef GLboolean(APIENTRYP PFNDOLISSYNCPROC)(GLsync sync);
typedef void (APIENTRYP PFNDOLDELETESYNCPROC) (GLsync sync); typedef void(APIENTRYP PFNDOLDELETESYNCPROC)(GLsync sync);
typedef GLenum (APIENTRYP PFNDOLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); typedef GLenum(APIENTRYP PFNDOLCLIENTWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout);
typedef void (APIENTRYP PFNDOLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); typedef void(APIENTRYP PFNDOLWAITSYNCPROC)(GLsync sync, GLbitfield flags, GLuint64 timeout);
typedef void (APIENTRYP PFNDOLGETINTEGER64VPROC) (GLenum pname, GLint64 *data); typedef void(APIENTRYP PFNDOLGETINTEGER64VPROC)(GLenum pname, GLint64* data);
typedef void (APIENTRYP PFNDOLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); typedef void(APIENTRYP PFNDOLGETSYNCIVPROC)(GLsync sync, GLenum pname, GLsizei bufSize,
typedef void (APIENTRYP PFNDOLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data); GLsizei* length, GLint* values);
typedef void(APIENTRYP PFNDOLGETINTEGER64I_VPROC)(GLenum target, GLuint index, GLint64* data);
extern PFNDOLCLIENTWAITSYNCPROC dolClientWaitSync; extern PFNDOLCLIENTWAITSYNCPROC dolClientWaitSync;
extern PFNDOLDELETESYNCPROC dolDeleteSync; extern PFNDOLDELETESYNCPROC dolDeleteSync;

View File

@ -23,10 +23,16 @@
#include "Common/GL/GLExtensions/gl_common.h" #include "Common/GL/GLExtensions/gl_common.h"
typedef void (APIENTRYP PFNDOLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); typedef void(APIENTRYP PFNDOLTEXIMAGE2DMULTISAMPLEPROC)(GLenum target, GLsizei samples,
typedef void (APIENTRYP PFNDOLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); GLenum internalformat, GLsizei width,
typedef void (APIENTRYP PFNDOLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val); GLsizei height,
typedef void (APIENTRYP PFNDOLSAMPLEMASKIPROC) (GLuint maskNumber, GLbitfield mask); GLboolean fixedsamplelocations);
typedef void(APIENTRYP PFNDOLTEXIMAGE3DMULTISAMPLEPROC)(GLenum target, GLsizei samples,
GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth,
GLboolean fixedsamplelocations);
typedef void(APIENTRYP PFNDOLGETMULTISAMPLEFVPROC)(GLenum pname, GLuint index, GLfloat* val);
typedef void(APIENTRYP PFNDOLSAMPLEMASKIPROC)(GLuint maskNumber, GLbitfield mask);
extern PFNDOLTEXIMAGE2DMULTISAMPLEPROC dolTexImage2DMultisample; extern PFNDOLTEXIMAGE2DMULTISAMPLEPROC dolTexImage2DMultisample;
extern PFNDOLTEXIMAGE3DMULTISAMPLEPROC dolTexImage3DMultisample; extern PFNDOLTEXIMAGE3DMULTISAMPLEPROC dolTexImage3DMultisample;

View File

@ -23,8 +23,14 @@
#include "Common/GL/GLExtensions/gl_common.h" #include "Common/GL/GLExtensions/gl_common.h"
typedef void (APIENTRYP PFNDOLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); typedef void(APIENTRYP PFNDOLTEXSTORAGE2DMULTISAMPLEPROC)(GLenum target, GLsizei samples,
typedef void (APIENTRYP PFNDOLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); GLenum internalformat, GLsizei width,
GLsizei height,
GLboolean fixedsamplelocations);
typedef void(APIENTRYP PFNDOLTEXSTORAGE3DMULTISAMPLEPROC)(GLenum target, GLsizei samples,
GLenum internalformat, GLsizei width,
GLsizei height, GLsizei depth,
GLboolean fixedsamplelocations);
extern PFNDOLTEXSTORAGE2DMULTISAMPLEPROC dolTexStorage2DMultisample; extern PFNDOLTEXSTORAGE2DMULTISAMPLEPROC dolTexStorage2DMultisample;
extern PFNDOLTEXSTORAGE3DMULTISAMPLEPROC dolTexStorage3DMultisample; extern PFNDOLTEXSTORAGE3DMULTISAMPLEPROC dolTexStorage3DMultisample;

View File

@ -23,16 +23,29 @@
#include "Common/GL/GLExtensions/gl_common.h" #include "Common/GL/GLExtensions/gl_common.h"
typedef void (APIENTRYP PFNDOLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data); typedef void(APIENTRYP PFNDOLGETINTEGERI_VPROC)(GLenum target, GLuint index, GLint* data);
typedef void (APIENTRYP PFNDOLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); typedef void(APIENTRYP PFNDOLBINDBUFFERRANGEPROC)(GLenum target, GLuint index, GLuint buffer,
typedef void (APIENTRYP PFNDOLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer); GLintptr offset, GLsizeiptr size);
typedef void (APIENTRYP PFNDOLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); typedef void(APIENTRYP PFNDOLBINDBUFFERBASEPROC)(GLenum target, GLuint index, GLuint buffer);
typedef void (APIENTRYP PFNDOLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); typedef void(APIENTRYP PFNDOLGETUNIFORMINDICESPROC)(GLuint program, GLsizei uniformCount,
typedef void (APIENTRYP PFNDOLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName); const GLchar* const* uniformNames,
typedef GLuint (APIENTRYP PFNDOLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName); GLuint* uniformIndices);
typedef void (APIENTRYP PFNDOLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); typedef void(APIENTRYP PFNDOLGETACTIVEUNIFORMSIVPROC)(GLuint program, GLsizei uniformCount,
typedef void (APIENTRYP PFNDOLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); const GLuint* uniformIndices, GLenum pname,
typedef void (APIENTRYP PFNDOLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); GLint* params);
typedef void(APIENTRYP PFNDOLGETACTIVEUNIFORMNAMEPROC)(GLuint program, GLuint uniformIndex,
GLsizei bufSize, GLsizei* length,
GLchar* uniformName);
typedef GLuint(APIENTRYP PFNDOLGETUNIFORMBLOCKINDEXPROC)(GLuint program,
const GLchar* uniformBlockName);
typedef void(APIENTRYP PFNDOLGETACTIVEUNIFORMBLOCKIVPROC)(GLuint program, GLuint uniformBlockIndex,
GLenum pname, GLint* params);
typedef void(APIENTRYP PFNDOLGETACTIVEUNIFORMBLOCKNAMEPROC)(GLuint program,
GLuint uniformBlockIndex,
GLsizei bufSize, GLsizei* length,
GLchar* uniformBlockName);
typedef void(APIENTRYP PFNDOLUNIFORMBLOCKBINDINGPROC)(GLuint program, GLuint uniformBlockIndex,
GLuint uniformBlockBinding);
extern PFNDOLBINDBUFFERBASEPROC dolBindBufferBase; extern PFNDOLBINDBUFFERBASEPROC dolBindBufferBase;
extern PFNDOLBINDBUFFERRANGEPROC dolBindBufferRange; extern PFNDOLBINDBUFFERRANGEPROC dolBindBufferRange;

View File

@ -23,10 +23,10 @@
#include "Common/GL/GLExtensions/gl_common.h" #include "Common/GL/GLExtensions/gl_common.h"
typedef void (APIENTRYP PFNDOLBINDVERTEXARRAYPROC) (GLuint array); typedef void(APIENTRYP PFNDOLBINDVERTEXARRAYPROC)(GLuint array);
typedef void (APIENTRYP PFNDOLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays); typedef void(APIENTRYP PFNDOLDELETEVERTEXARRAYSPROC)(GLsizei n, const GLuint* arrays);
typedef void (APIENTRYP PFNDOLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays); typedef void(APIENTRYP PFNDOLGENVERTEXARRAYSPROC)(GLsizei n, GLuint* arrays);
typedef GLboolean (APIENTRYP PFNDOLISVERTEXARRAYPROC) (GLuint array); typedef GLboolean(APIENTRYP PFNDOLISVERTEXARRAYPROC)(GLuint array);
extern PFNDOLBINDVERTEXARRAYPROC dolBindVertexArray; extern PFNDOLBINDVERTEXARRAYPROC dolBindVertexArray;
extern PFNDOLDELETEVERTEXARRAYSPROC dolDeleteVertexArrays; extern PFNDOLDELETEVERTEXARRAYSPROC dolDeleteVertexArrays;

View File

@ -23,16 +23,18 @@
#include "Common/GL/GLExtensions/gl_common.h" #include "Common/GL/GLExtensions/gl_common.h"
typedef void (APIENTRYP PFNDOLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v); typedef void(APIENTRYP PFNDOLVIEWPORTARRAYVPROC)(GLuint first, GLsizei count, const GLfloat* v);
typedef void (APIENTRYP PFNDOLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); typedef void(APIENTRYP PFNDOLVIEWPORTINDEXEDFPROC)(GLuint index, GLfloat x, GLfloat y, GLfloat w,
typedef void (APIENTRYP PFNDOLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v); GLfloat h);
typedef void (APIENTRYP PFNDOLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v); typedef void(APIENTRYP PFNDOLVIEWPORTINDEXEDFVPROC)(GLuint index, const GLfloat* v);
typedef void (APIENTRYP PFNDOLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); typedef void(APIENTRYP PFNDOLSCISSORARRAYVPROC)(GLuint first, GLsizei count, const GLint* v);
typedef void (APIENTRYP PFNDOLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v); typedef void(APIENTRYP PFNDOLSCISSORINDEXEDPROC)(GLuint index, GLint left, GLint bottom,
typedef void (APIENTRYP PFNDOLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLdouble *v); GLsizei width, GLsizei height);
typedef void (APIENTRYP PFNDOLDEPTHRANGEINDEXEDPROC) (GLuint index, GLdouble n, GLdouble f); typedef void(APIENTRYP PFNDOLSCISSORINDEXEDVPROC)(GLuint index, const GLint* v);
typedef void (APIENTRYP PFNDOLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data); typedef void(APIENTRYP PFNDOLDEPTHRANGEARRAYVPROC)(GLuint first, GLsizei count, const GLdouble* v);
typedef void (APIENTRYP PFNDOLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data); typedef void(APIENTRYP PFNDOLDEPTHRANGEINDEXEDPROC)(GLuint index, GLdouble n, GLdouble f);
typedef void(APIENTRYP PFNDOLGETFLOATI_VPROC)(GLenum target, GLuint index, GLfloat* data);
typedef void(APIENTRYP PFNDOLGETDOUBLEI_VPROC)(GLenum target, GLuint index, GLdouble* data);
extern PFNDOLDEPTHRANGEARRAYVPROC dolDepthRangeArrayv; extern PFNDOLDEPTHRANGEARRAYVPROC dolDepthRangeArrayv;
extern PFNDOLDEPTHRANGEINDEXEDPROC dolDepthRangeIndexed; extern PFNDOLDEPTHRANGEINDEXEDPROC dolDepthRangeIndexed;

File diff suppressed because it is too large Load Diff

View File

@ -7,14 +7,14 @@
#include "Common/CommonTypes.h" #include "Common/CommonTypes.h"
#include "Common/GL/GLExtensions/AMD_pinned_memory.h" #include "Common/GL/GLExtensions/AMD_pinned_memory.h"
#include "Common/GL/GLExtensions/ARB_ES2_compatibility.h"
#include "Common/GL/GLExtensions/ARB_ES3_compatibility.h"
#include "Common/GL/GLExtensions/ARB_blend_func_extended.h" #include "Common/GL/GLExtensions/ARB_blend_func_extended.h"
#include "Common/GL/GLExtensions/ARB_buffer_storage.h" #include "Common/GL/GLExtensions/ARB_buffer_storage.h"
#include "Common/GL/GLExtensions/ARB_clip_control.h" #include "Common/GL/GLExtensions/ARB_clip_control.h"
#include "Common/GL/GLExtensions/ARB_copy_image.h" #include "Common/GL/GLExtensions/ARB_copy_image.h"
#include "Common/GL/GLExtensions/ARB_debug_output.h" #include "Common/GL/GLExtensions/ARB_debug_output.h"
#include "Common/GL/GLExtensions/ARB_draw_elements_base_vertex.h" #include "Common/GL/GLExtensions/ARB_draw_elements_base_vertex.h"
#include "Common/GL/GLExtensions/ARB_ES2_compatibility.h"
#include "Common/GL/GLExtensions/ARB_ES3_compatibility.h"
#include "Common/GL/GLExtensions/ARB_framebuffer_object.h" #include "Common/GL/GLExtensions/ARB_framebuffer_object.h"
#include "Common/GL/GLExtensions/ARB_get_program_binary.h" #include "Common/GL/GLExtensions/ARB_get_program_binary.h"
#include "Common/GL/GLExtensions/ARB_map_buffer_range.h" #include "Common/GL/GLExtensions/ARB_map_buffer_range.h"
@ -29,6 +29,10 @@
#include "Common/GL/GLExtensions/ARB_vertex_array_object.h" #include "Common/GL/GLExtensions/ARB_vertex_array_object.h"
#include "Common/GL/GLExtensions/ARB_viewport_array.h" #include "Common/GL/GLExtensions/ARB_viewport_array.h"
#include "Common/GL/GLExtensions/EXT_texture_filter_anisotropic.h" #include "Common/GL/GLExtensions/EXT_texture_filter_anisotropic.h"
#include "Common/GL/GLExtensions/HP_occlusion_test.h"
#include "Common/GL/GLExtensions/KHR_debug.h"
#include "Common/GL/GLExtensions/NV_occlusion_query_samples.h"
#include "Common/GL/GLExtensions/NV_primitive_restart.h"
#include "Common/GL/GLExtensions/gl_1_1.h" #include "Common/GL/GLExtensions/gl_1_1.h"
#include "Common/GL/GLExtensions/gl_1_2.h" #include "Common/GL/GLExtensions/gl_1_2.h"
#include "Common/GL/GLExtensions/gl_1_3.h" #include "Common/GL/GLExtensions/gl_1_3.h"
@ -43,20 +47,16 @@
#include "Common/GL/GLExtensions/gl_4_3.h" #include "Common/GL/GLExtensions/gl_4_3.h"
#include "Common/GL/GLExtensions/gl_4_4.h" #include "Common/GL/GLExtensions/gl_4_4.h"
#include "Common/GL/GLExtensions/gl_4_5.h" #include "Common/GL/GLExtensions/gl_4_5.h"
#include "Common/GL/GLExtensions/HP_occlusion_test.h"
#include "Common/GL/GLExtensions/KHR_debug.h"
#include "Common/GL/GLExtensions/NV_occlusion_query_samples.h"
#include "Common/GL/GLExtensions/NV_primitive_restart.h"
namespace GLExtensions namespace GLExtensions
{ {
// Initializes the interface // Initializes the interface
bool Init(); bool Init();
// Function for checking if the hardware supports an extension // Function for checking if the hardware supports an extension
// example: if (GLExtensions::Supports("GL_ARB_multi_map")) // example: if (GLExtensions::Supports("GL_ARB_multi_map"))
bool Supports(const std::string& name); bool Supports(const std::string& name);
// Returns OpenGL version in format 430 // Returns OpenGL version in format 430
u32 Version(); u32 Version();
} }

View File

@ -64,18 +64,31 @@
#define GL_DEBUG_SEVERITY_LOW 0x9148 #define GL_DEBUG_SEVERITY_LOW 0x9148
#define GL_DEBUG_OUTPUT 0x92E0 #define GL_DEBUG_OUTPUT 0x92E0
typedef void (APIENTRYP GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); typedef void(APIENTRYP GLDEBUGPROC)(GLenum source, GLenum type, GLuint id, GLenum severity,
GLsizei length, const GLchar* message, const void* userParam);
typedef void (APIENTRYP PFNDOLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const GLvoid *userParam); typedef void(APIENTRYP PFNDOLDEBUGMESSAGECALLBACKPROC)(GLDEBUGPROC callback,
typedef void (APIENTRYP PFNDOLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint* ids, GLboolean enabled); const GLvoid* userParam);
typedef void (APIENTRYP PFNDOLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* buf); typedef void(APIENTRYP PFNDOLDEBUGMESSAGECONTROLPROC)(GLenum source, GLenum type, GLenum severity,
typedef GLuint (APIENTRYP PFNDOLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufsize, GLenum* sources, GLenum* types, GLuint* ids, GLenum* severities, GLsizei* lengths, GLchar* messageLog); GLsizei count, const GLuint* ids,
typedef void (APIENTRYP PFNDOLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei* length, GLchar *label); GLboolean enabled);
typedef void (APIENTRYP PFNDOLGETOBJECTPTRLABELPROC) (void* ptr, GLsizei bufSize, GLsizei* length, GLchar *label); typedef void(APIENTRYP PFNDOLDEBUGMESSAGEINSERTPROC)(GLenum source, GLenum type, GLuint id,
typedef void (APIENTRYP PFNDOLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar* label); GLenum severity, GLsizei length,
typedef void (APIENTRYP PFNDOLOBJECTPTRLABELPROC) (void* ptr, GLsizei length, const GLchar* label); const GLchar* buf);
typedef void (APIENTRYP PFNDOLPOPDEBUGGROUPPROC) (void); typedef GLuint(APIENTRYP PFNDOLGETDEBUGMESSAGELOGPROC)(GLuint count, GLsizei bufsize,
typedef void (APIENTRYP PFNDOLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar * message); GLenum* sources, GLenum* types, GLuint* ids,
GLenum* severities, GLsizei* lengths,
GLchar* messageLog);
typedef void(APIENTRYP PFNDOLGETOBJECTLABELPROC)(GLenum identifier, GLuint name, GLsizei bufSize,
GLsizei* length, GLchar* label);
typedef void(APIENTRYP PFNDOLGETOBJECTPTRLABELPROC)(void* ptr, GLsizei bufSize, GLsizei* length,
GLchar* label);
typedef void(APIENTRYP PFNDOLOBJECTLABELPROC)(GLenum identifier, GLuint name, GLsizei length,
const GLchar* label);
typedef void(APIENTRYP PFNDOLOBJECTPTRLABELPROC)(void* ptr, GLsizei length, const GLchar* label);
typedef void(APIENTRYP PFNDOLPOPDEBUGGROUPPROC)(void);
typedef void(APIENTRYP PFNDOLPUSHDEBUGGROUPPROC)(GLenum source, GLuint id, GLsizei length,
const GLchar* message);
extern PFNDOLDEBUGMESSAGECALLBACKPROC dolDebugMessageCallback; extern PFNDOLDEBUGMESSAGECALLBACKPROC dolDebugMessageCallback;
extern PFNDOLDEBUGMESSAGECONTROLPROC dolDebugMessageControl; extern PFNDOLDEBUGMESSAGECONTROLPROC dolDebugMessageControl;

View File

@ -28,13 +28,13 @@
#define GL_PIXEL_COUNT_NV 0x8866 #define GL_PIXEL_COUNT_NV 0x8866
#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867 #define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867
typedef void (APIENTRYP PFNDOLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids); typedef void(APIENTRYP PFNDOLGENOCCLUSIONQUERIESNVPROC)(GLsizei n, GLuint* ids);
typedef void (APIENTRYP PFNDOLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids); typedef void(APIENTRYP PFNDOLDELETEOCCLUSIONQUERIESNVPROC)(GLsizei n, const GLuint* ids);
typedef GLboolean (APIENTRYP PFNDOLISOCCLUSIONQUERYNVPROC) (GLuint id); typedef GLboolean(APIENTRYP PFNDOLISOCCLUSIONQUERYNVPROC)(GLuint id);
typedef void (APIENTRYP PFNDOLBEGINOCCLUSIONQUERYNVPROC) (GLuint id); typedef void(APIENTRYP PFNDOLBEGINOCCLUSIONQUERYNVPROC)(GLuint id);
typedef void (APIENTRYP PFNDOLENDOCCLUSIONQUERYNVPROC) (void); typedef void(APIENTRYP PFNDOLENDOCCLUSIONQUERYNVPROC)(void);
typedef void (APIENTRYP PFNDOLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params); typedef void(APIENTRYP PFNDOLGETOCCLUSIONQUERYIVNVPROC)(GLuint id, GLenum pname, GLint* params);
typedef void (APIENTRYP PFNDOLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params); typedef void(APIENTRYP PFNDOLGETOCCLUSIONQUERYUIVNVPROC)(GLuint id, GLenum pname, GLuint* params);
extern PFNDOLGENOCCLUSIONQUERIESNVPROC dolGenOcclusionQueriesNV; extern PFNDOLGENOCCLUSIONQUERIESNVPROC dolGenOcclusionQueriesNV;
extern PFNDOLDELETEOCCLUSIONQUERIESNVPROC dolDeleteOcclusionQueriesNV; extern PFNDOLDELETEOCCLUSIONQUERIESNVPROC dolDeleteOcclusionQueriesNV;

View File

@ -26,8 +26,8 @@
#define GL_PRIMITIVE_RESTART_NV 0x8558 #define GL_PRIMITIVE_RESTART_NV 0x8558
#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559 #define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559
typedef void (APIENTRYP PFNDOLPRIMITIVERESTARTINDEXNVPROC) (GLuint index); typedef void(APIENTRYP PFNDOLPRIMITIVERESTARTINDEXNVPROC)(GLuint index);
typedef void (APIENTRYP PFNDOLPRIMITIVERESTARTNVPROC) (void); typedef void(APIENTRYP PFNDOLPRIMITIVERESTARTNVPROC)(void);
extern PFNDOLPRIMITIVERESTARTINDEXNVPROC dolPrimitiveRestartIndexNV; extern PFNDOLPRIMITIVERESTARTINDEXNVPROC dolPrimitiveRestartIndexNV;
extern PFNDOLPRIMITIVERESTARTNVPROC dolPrimitiveRestartNV; extern PFNDOLPRIMITIVERESTARTNVPROC dolPrimitiveRestartNV;

View File

@ -579,7 +579,6 @@
#define GL_SCISSOR_BIT 0x00080000 #define GL_SCISSOR_BIT 0x00080000
#define GL_ALL_ATTRIB_BITS 0x000FFFFF #define GL_ALL_ATTRIB_BITS 0x000FFFFF
/* OpenGL 1.1 */ /* OpenGL 1.1 */
#define GL_PROXY_TEXTURE_1D 0x8063 #define GL_PROXY_TEXTURE_1D 0x8063
#define GL_PROXY_TEXTURE_2D 0x8064 #define GL_PROXY_TEXTURE_2D 0x8064
@ -626,342 +625,387 @@
#define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF #define GL_ALL_CLIENT_ATTRIB_BITS 0xFFFFFFFF
#define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF #define GL_CLIENT_ALL_ATTRIB_BITS 0xFFFFFFFF
typedef void (APIENTRYP PFNDOLCLEARINDEXPROC) ( GLfloat c ); typedef void(APIENTRYP PFNDOLCLEARINDEXPROC)(GLfloat c);
typedef void (APIENTRYP PFNDOLCLEARCOLORPROC) ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ); typedef void(APIENTRYP PFNDOLCLEARCOLORPROC)(GLclampf red, GLclampf green, GLclampf blue,
typedef void (APIENTRYP PFNDOLCLEARPROC) ( GLbitfield mask ); GLclampf alpha);
typedef void (APIENTRYP PFNDOLINDEXMASKPROC) ( GLuint mask ); typedef void(APIENTRYP PFNDOLCLEARPROC)(GLbitfield mask);
typedef void (APIENTRYP PFNDOLCOLORMASKPROC) ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ); typedef void(APIENTRYP PFNDOLINDEXMASKPROC)(GLuint mask);
typedef void (APIENTRYP PFNDOLALPHAFUNCPROC) ( GLenum func, GLclampf ref ); typedef void(APIENTRYP PFNDOLCOLORMASKPROC)(GLboolean red, GLboolean green, GLboolean blue,
typedef void (APIENTRYP PFNDOLBLENDFUNCPROC) ( GLenum sfactor, GLenum dfactor ); GLboolean alpha);
typedef void (APIENTRYP PFNDOLLOGICOPPROC) ( GLenum opcode ); typedef void(APIENTRYP PFNDOLALPHAFUNCPROC)(GLenum func, GLclampf ref);
typedef void (APIENTRYP PFNDOLCULLFACEPROC) ( GLenum mode ); typedef void(APIENTRYP PFNDOLBLENDFUNCPROC)(GLenum sfactor, GLenum dfactor);
typedef void (APIENTRYP PFNDOLFRONTFACEPROC) ( GLenum mode ); typedef void(APIENTRYP PFNDOLLOGICOPPROC)(GLenum opcode);
typedef void (APIENTRYP PFNDOLPOINTSIZEPROC) ( GLfloat size ); typedef void(APIENTRYP PFNDOLCULLFACEPROC)(GLenum mode);
typedef void (APIENTRYP PFNDOLLINEWIDTHPROC) ( GLfloat width ); typedef void(APIENTRYP PFNDOLFRONTFACEPROC)(GLenum mode);
typedef void (APIENTRYP PFNDOLLINESTIPPLEPROC) ( GLint factor, GLushort pattern ); typedef void(APIENTRYP PFNDOLPOINTSIZEPROC)(GLfloat size);
typedef void (APIENTRYP PFNDOLPOLYGONMODEPROC) ( GLenum face, GLenum mode ); typedef void(APIENTRYP PFNDOLLINEWIDTHPROC)(GLfloat width);
typedef void (APIENTRYP PFNDOLPOLYGONOFFSETPROC) ( GLfloat factor, GLfloat units ); typedef void(APIENTRYP PFNDOLLINESTIPPLEPROC)(GLint factor, GLushort pattern);
typedef void (APIENTRYP PFNDOLPOLYGONSTIPPLEPROC) ( const GLubyte *mask ); typedef void(APIENTRYP PFNDOLPOLYGONMODEPROC)(GLenum face, GLenum mode);
typedef void (APIENTRYP PFNDOLGETPOLYGONSTIPPLEPROC) ( GLubyte *mask ); typedef void(APIENTRYP PFNDOLPOLYGONOFFSETPROC)(GLfloat factor, GLfloat units);
typedef void (APIENTRYP PFNDOLEDGEFLAGPROC) ( GLboolean flag ); typedef void(APIENTRYP PFNDOLPOLYGONSTIPPLEPROC)(const GLubyte* mask);
typedef void (APIENTRYP PFNDOLEDGEFLAGVPROC) ( const GLboolean *flag ); typedef void(APIENTRYP PFNDOLGETPOLYGONSTIPPLEPROC)(GLubyte* mask);
typedef void (APIENTRYP PFNDOLSCISSORPROC) ( GLint x, GLint y, GLsizei width, GLsizei height); typedef void(APIENTRYP PFNDOLEDGEFLAGPROC)(GLboolean flag);
typedef void (APIENTRYP PFNDOLCLIPPLANEPROC) ( GLenum plane, const GLdouble *equation ); typedef void(APIENTRYP PFNDOLEDGEFLAGVPROC)(const GLboolean* flag);
typedef void (APIENTRYP PFNDOLGETCLIPPLANEPROC) ( GLenum plane, GLdouble *equation ); typedef void(APIENTRYP PFNDOLSCISSORPROC)(GLint x, GLint y, GLsizei width, GLsizei height);
typedef void (APIENTRYP PFNDOLDRAWBUFFERPROC) ( GLenum mode ); typedef void(APIENTRYP PFNDOLCLIPPLANEPROC)(GLenum plane, const GLdouble* equation);
typedef void (APIENTRYP PFNDOLREADBUFFERPROC) ( GLenum mode ); typedef void(APIENTRYP PFNDOLGETCLIPPLANEPROC)(GLenum plane, GLdouble* equation);
typedef void (APIENTRYP PFNDOLENABLEPROC) ( GLenum cap ); typedef void(APIENTRYP PFNDOLDRAWBUFFERPROC)(GLenum mode);
typedef void (APIENTRYP PFNDOLDISABLEPROC) ( GLenum cap ); typedef void(APIENTRYP PFNDOLREADBUFFERPROC)(GLenum mode);
typedef GLboolean (APIENTRYP PFNDOLISENABLEDPROC) ( GLenum cap ); typedef void(APIENTRYP PFNDOLENABLEPROC)(GLenum cap);
typedef void (APIENTRYP PFNDOLENABLECLIENTSTATEPROC) ( GLenum cap ); /* 1.1 */ typedef void(APIENTRYP PFNDOLDISABLEPROC)(GLenum cap);
typedef void (APIENTRYP PFNDOLDISABLECLIENTSTATEPROC) ( GLenum cap ); /* 1.1 */ typedef GLboolean(APIENTRYP PFNDOLISENABLEDPROC)(GLenum cap);
typedef void (APIENTRYP PFNDOLGETBOOLEANVPROC) ( GLenum pname, GLboolean *params ); typedef void(APIENTRYP PFNDOLENABLECLIENTSTATEPROC)(GLenum cap); /* 1.1 */
typedef void (APIENTRYP PFNDOLGETDOUBLEVPROC) ( GLenum pname, GLdouble *params ); typedef void(APIENTRYP PFNDOLDISABLECLIENTSTATEPROC)(GLenum cap); /* 1.1 */
typedef void (APIENTRYP PFNDOLGETFLOATVPROC) ( GLenum pname, GLfloat *params ); typedef void(APIENTRYP PFNDOLGETBOOLEANVPROC)(GLenum pname, GLboolean* params);
typedef void (APIENTRYP PFNDOLGETINTEGERVPROC) ( GLenum pname, GLint *params ); typedef void(APIENTRYP PFNDOLGETDOUBLEVPROC)(GLenum pname, GLdouble* params);
typedef void (APIENTRYP PFNDOLPUSHATTRIBPROC) ( GLbitfield mask ); typedef void(APIENTRYP PFNDOLGETFLOATVPROC)(GLenum pname, GLfloat* params);
typedef void (APIENTRYP PFNDOLPOPATTRIBPROC) ( void ); typedef void(APIENTRYP PFNDOLGETINTEGERVPROC)(GLenum pname, GLint* params);
typedef void (APIENTRYP PFNDOLPUSHCLIENTATTRIBPROC) ( GLbitfield mask ); /* 1.1 */ typedef void(APIENTRYP PFNDOLPUSHATTRIBPROC)(GLbitfield mask);
typedef void (APIENTRYP PFNDOLPOPCLIENTATTRIBPROC) ( void ); /* 1.1 */ typedef void(APIENTRYP PFNDOLPOPATTRIBPROC)(void);
typedef GLint (APIENTRYP PFNDOLRENDERMODEPROC) ( GLenum mode ); typedef void(APIENTRYP PFNDOLPUSHCLIENTATTRIBPROC)(GLbitfield mask); /* 1.1 */
typedef GLenum (APIENTRYP PFNDOLGETERRORPROC) ( void ); typedef void(APIENTRYP PFNDOLPOPCLIENTATTRIBPROC)(void); /* 1.1 */
typedef const GLubyte* (APIENTRYP PFNDOLGETSTRINGPROC) ( GLenum name ); typedef GLint(APIENTRYP PFNDOLRENDERMODEPROC)(GLenum mode);
typedef void (APIENTRYP PFNDOLFINISHPROC) ( void ); typedef GLenum(APIENTRYP PFNDOLGETERRORPROC)(void);
typedef void (APIENTRYP PFNDOLFLUSHPROC) ( void ); typedef const GLubyte*(APIENTRYP PFNDOLGETSTRINGPROC)(GLenum name);
typedef void (APIENTRYP PFNDOLHINTPROC) ( GLenum target, GLenum mode ); typedef void(APIENTRYP PFNDOLFINISHPROC)(void);
typedef void (APIENTRYP PFNDOLCLEARDEPTHPROC) ( GLclampd depth ); typedef void(APIENTRYP PFNDOLFLUSHPROC)(void);
typedef void (APIENTRYP PFNDOLDEPTHFUNCPROC) ( GLenum func ); typedef void(APIENTRYP PFNDOLHINTPROC)(GLenum target, GLenum mode);
typedef void (APIENTRYP PFNDOLDEPTHMASKPROC) ( GLboolean flag ); typedef void(APIENTRYP PFNDOLCLEARDEPTHPROC)(GLclampd depth);
typedef void (APIENTRYP PFNDOLDEPTHRANGEPROC) ( GLclampd near_val, GLclampd far_val ); typedef void(APIENTRYP PFNDOLDEPTHFUNCPROC)(GLenum func);
typedef void (APIENTRYP PFNDOLCLEARACCUMPROC) ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); typedef void(APIENTRYP PFNDOLDEPTHMASKPROC)(GLboolean flag);
typedef void (APIENTRYP PFNDOLACCUMPROC) ( GLenum op, GLfloat value ); typedef void(APIENTRYP PFNDOLDEPTHRANGEPROC)(GLclampd near_val, GLclampd far_val);
typedef void (APIENTRYP PFNDOLMATRIXMODEPROC) ( GLenum mode ); typedef void(APIENTRYP PFNDOLCLEARACCUMPROC)(GLfloat red, GLfloat green, GLfloat blue,
typedef void (APIENTRYP PFNDOLORTHOPROC) ( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val ); GLfloat alpha);
typedef void (APIENTRYP PFNDOLFRUSTUMPROC) ( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val ); typedef void(APIENTRYP PFNDOLACCUMPROC)(GLenum op, GLfloat value);
typedef void (APIENTRYP PFNDOLVIEWPORTPROC) ( GLint x, GLint y, GLsizei width, GLsizei height ); typedef void(APIENTRYP PFNDOLMATRIXMODEPROC)(GLenum mode);
typedef void (APIENTRYP PFNDOLPUSHMATRIXPROC) ( void ); typedef void(APIENTRYP PFNDOLORTHOPROC)(GLdouble left, GLdouble right, GLdouble bottom,
typedef void (APIENTRYP PFNDOLPOPMATRIXPROC) ( void ); GLdouble top, GLdouble near_val, GLdouble far_val);
typedef void (APIENTRYP PFNDOLLOADIDENTITYPROC) ( void ); typedef void(APIENTRYP PFNDOLFRUSTUMPROC)(GLdouble left, GLdouble right, GLdouble bottom,
typedef void (APIENTRYP PFNDOLLOADMATRIXDPROC) ( const GLdouble *m ); GLdouble top, GLdouble near_val, GLdouble far_val);
typedef void (APIENTRYP PFNDOLLOADMATRIXFPROC) ( const GLfloat *m ); typedef void(APIENTRYP PFNDOLVIEWPORTPROC)(GLint x, GLint y, GLsizei width, GLsizei height);
typedef void (APIENTRYP PFNDOLMULTMATRIXDPROC) ( const GLdouble *m ); typedef void(APIENTRYP PFNDOLPUSHMATRIXPROC)(void);
typedef void (APIENTRYP PFNDOLMULTMATRIXFPROC) ( const GLfloat *m ); typedef void(APIENTRYP PFNDOLPOPMATRIXPROC)(void);
typedef void (APIENTRYP PFNDOLROTATEDPROC) ( GLdouble angle, GLdouble x, GLdouble y, GLdouble z ); typedef void(APIENTRYP PFNDOLLOADIDENTITYPROC)(void);
typedef void (APIENTRYP PFNDOLROTATEFPROC) ( GLfloat angle, GLfloat x, GLfloat y, GLfloat z ); typedef void(APIENTRYP PFNDOLLOADMATRIXDPROC)(const GLdouble* m);
typedef void (APIENTRYP PFNDOLSCALEDPROC) ( GLdouble x, GLdouble y, GLdouble z ); typedef void(APIENTRYP PFNDOLLOADMATRIXFPROC)(const GLfloat* m);
typedef void (APIENTRYP PFNDOLSCALEFPROC) ( GLfloat x, GLfloat y, GLfloat z ); typedef void(APIENTRYP PFNDOLMULTMATRIXDPROC)(const GLdouble* m);
typedef void (APIENTRYP PFNDOLTRANSLATEDPROC) ( GLdouble x, GLdouble y, GLdouble z ); typedef void(APIENTRYP PFNDOLMULTMATRIXFPROC)(const GLfloat* m);
typedef void (APIENTRYP PFNDOLTRANSLATEFPROC) ( GLfloat x, GLfloat y, GLfloat z ); typedef void(APIENTRYP PFNDOLROTATEDPROC)(GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
typedef GLboolean (APIENTRYP PFNDOLISLISTPROC) ( GLuint list ); typedef void(APIENTRYP PFNDOLROTATEFPROC)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
typedef void (APIENTRYP PFNDOLDELETELISTSPROC) ( GLuint list, GLsizei range ); typedef void(APIENTRYP PFNDOLSCALEDPROC)(GLdouble x, GLdouble y, GLdouble z);
typedef GLuint (APIENTRYP PFNDOLGENLISTSPROC) ( GLsizei range ); typedef void(APIENTRYP PFNDOLSCALEFPROC)(GLfloat x, GLfloat y, GLfloat z);
typedef void (APIENTRYP PFNDOLNEWLISTPROC) ( GLuint list, GLenum mode ); typedef void(APIENTRYP PFNDOLTRANSLATEDPROC)(GLdouble x, GLdouble y, GLdouble z);
typedef void (APIENTRYP PFNDOLENDLISTPROC) ( void ); typedef void(APIENTRYP PFNDOLTRANSLATEFPROC)(GLfloat x, GLfloat y, GLfloat z);
typedef void (APIENTRYP PFNDOLCALLLISTPROC) ( GLuint list ); typedef GLboolean(APIENTRYP PFNDOLISLISTPROC)(GLuint list);
typedef void (APIENTRYP PFNDOLCALLLISTSPROC) ( GLsizei n, GLenum type, const GLvoid *lists ); typedef void(APIENTRYP PFNDOLDELETELISTSPROC)(GLuint list, GLsizei range);
typedef void (APIENTRYP PFNDOLLISTBASEPROC) ( GLuint base ); typedef GLuint(APIENTRYP PFNDOLGENLISTSPROC)(GLsizei range);
typedef void (APIENTRYP PFNDOLBEGINPROC) ( GLenum mode ); typedef void(APIENTRYP PFNDOLNEWLISTPROC)(GLuint list, GLenum mode);
typedef void (APIENTRYP PFNDOLENDPROC) ( void ); typedef void(APIENTRYP PFNDOLENDLISTPROC)(void);
typedef void (APIENTRYP PFNDOLVERTEX2DPROC) ( GLdouble x, GLdouble y ); typedef void(APIENTRYP PFNDOLCALLLISTPROC)(GLuint list);
typedef void (APIENTRYP PFNDOLVERTEX2FPROC) ( GLfloat x, GLfloat y ); typedef void(APIENTRYP PFNDOLCALLLISTSPROC)(GLsizei n, GLenum type, const GLvoid* lists);
typedef void (APIENTRYP PFNDOLVERTEX2IPROC) ( GLint x, GLint y ); typedef void(APIENTRYP PFNDOLLISTBASEPROC)(GLuint base);
typedef void (APIENTRYP PFNDOLVERTEX2SPROC) ( GLshort x, GLshort y ); typedef void(APIENTRYP PFNDOLBEGINPROC)(GLenum mode);
typedef void (APIENTRYP PFNDOLVERTEX3DPROC) ( GLdouble x, GLdouble y, GLdouble z ); typedef void(APIENTRYP PFNDOLENDPROC)(void);
typedef void (APIENTRYP PFNDOLVERTEX3FPROC) ( GLfloat x, GLfloat y, GLfloat z ); typedef void(APIENTRYP PFNDOLVERTEX2DPROC)(GLdouble x, GLdouble y);
typedef void (APIENTRYP PFNDOLVERTEX3IPROC) ( GLint x, GLint y, GLint z ); typedef void(APIENTRYP PFNDOLVERTEX2FPROC)(GLfloat x, GLfloat y);
typedef void (APIENTRYP PFNDOLVERTEX3SPROC) ( GLshort x, GLshort y, GLshort z ); typedef void(APIENTRYP PFNDOLVERTEX2IPROC)(GLint x, GLint y);
typedef void (APIENTRYP PFNDOLVERTEX4DPROC) ( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); typedef void(APIENTRYP PFNDOLVERTEX2SPROC)(GLshort x, GLshort y);
typedef void (APIENTRYP PFNDOLVERTEX4FPROC) ( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); typedef void(APIENTRYP PFNDOLVERTEX3DPROC)(GLdouble x, GLdouble y, GLdouble z);
typedef void (APIENTRYP PFNDOLVERTEX4IPROC) ( GLint x, GLint y, GLint z, GLint w ); typedef void(APIENTRYP PFNDOLVERTEX3FPROC)(GLfloat x, GLfloat y, GLfloat z);
typedef void (APIENTRYP PFNDOLVERTEX4SPROC) ( GLshort x, GLshort y, GLshort z, GLshort w ); typedef void(APIENTRYP PFNDOLVERTEX3IPROC)(GLint x, GLint y, GLint z);
typedef void (APIENTRYP PFNDOLVERTEX2DVPROC) ( const GLdouble *v ); typedef void(APIENTRYP PFNDOLVERTEX3SPROC)(GLshort x, GLshort y, GLshort z);
typedef void (APIENTRYP PFNDOLVERTEX2FVPROC) ( const GLfloat *v ); typedef void(APIENTRYP PFNDOLVERTEX4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
typedef void (APIENTRYP PFNDOLVERTEX2IVPROC) ( const GLint *v ); typedef void(APIENTRYP PFNDOLVERTEX4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void (APIENTRYP PFNDOLVERTEX2SVPROC) ( const GLshort *v ); typedef void(APIENTRYP PFNDOLVERTEX4IPROC)(GLint x, GLint y, GLint z, GLint w);
typedef void (APIENTRYP PFNDOLVERTEX3DVPROC) ( const GLdouble *v ); typedef void(APIENTRYP PFNDOLVERTEX4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w);
typedef void (APIENTRYP PFNDOLVERTEX3FVPROC) ( const GLfloat *v ); typedef void(APIENTRYP PFNDOLVERTEX2DVPROC)(const GLdouble* v);
typedef void (APIENTRYP PFNDOLVERTEX3IVPROC) ( const GLint *v ); typedef void(APIENTRYP PFNDOLVERTEX2FVPROC)(const GLfloat* v);
typedef void (APIENTRYP PFNDOLVERTEX3SVPROC) ( const GLshort *v ); typedef void(APIENTRYP PFNDOLVERTEX2IVPROC)(const GLint* v);
typedef void (APIENTRYP PFNDOLVERTEX4DVPROC) ( const GLdouble *v ); typedef void(APIENTRYP PFNDOLVERTEX2SVPROC)(const GLshort* v);
typedef void (APIENTRYP PFNDOLVERTEX4FVPROC) ( const GLfloat *v ); typedef void(APIENTRYP PFNDOLVERTEX3DVPROC)(const GLdouble* v);
typedef void (APIENTRYP PFNDOLVERTEX4IVPROC) ( const GLint *v ); typedef void(APIENTRYP PFNDOLVERTEX3FVPROC)(const GLfloat* v);
typedef void (APIENTRYP PFNDOLVERTEX4SVPROC) ( const GLshort *v ); typedef void(APIENTRYP PFNDOLVERTEX3IVPROC)(const GLint* v);
typedef void (APIENTRYP PFNDOLNORMAL3BPROC) ( GLbyte nx, GLbyte ny, GLbyte nz ); typedef void(APIENTRYP PFNDOLVERTEX3SVPROC)(const GLshort* v);
typedef void (APIENTRYP PFNDOLNORMAL3DPROC) ( GLdouble nx, GLdouble ny, GLdouble nz ); typedef void(APIENTRYP PFNDOLVERTEX4DVPROC)(const GLdouble* v);
typedef void (APIENTRYP PFNDOLNORMAL3FPROC) ( GLfloat nx, GLfloat ny, GLfloat nz ); typedef void(APIENTRYP PFNDOLVERTEX4FVPROC)(const GLfloat* v);
typedef void (APIENTRYP PFNDOLNORMAL3IPROC) ( GLint nx, GLint ny, GLint nz ); typedef void(APIENTRYP PFNDOLVERTEX4IVPROC)(const GLint* v);
typedef void (APIENTRYP PFNDOLNORMAL3SPROC) ( GLshort nx, GLshort ny, GLshort nz ); typedef void(APIENTRYP PFNDOLVERTEX4SVPROC)(const GLshort* v);
typedef void (APIENTRYP PFNDOLNORMAL3BVPROC) ( const GLbyte *v ); typedef void(APIENTRYP PFNDOLNORMAL3BPROC)(GLbyte nx, GLbyte ny, GLbyte nz);
typedef void (APIENTRYP PFNDOLNORMAL3DVPROC) ( const GLdouble *v ); typedef void(APIENTRYP PFNDOLNORMAL3DPROC)(GLdouble nx, GLdouble ny, GLdouble nz);
typedef void (APIENTRYP PFNDOLNORMAL3FVPROC) ( const GLfloat *v ); typedef void(APIENTRYP PFNDOLNORMAL3FPROC)(GLfloat nx, GLfloat ny, GLfloat nz);
typedef void (APIENTRYP PFNDOLNORMAL3IVPROC) ( const GLint *v ); typedef void(APIENTRYP PFNDOLNORMAL3IPROC)(GLint nx, GLint ny, GLint nz);
typedef void (APIENTRYP PFNDOLNORMAL3SVPROC) ( const GLshort *v ); typedef void(APIENTRYP PFNDOLNORMAL3SPROC)(GLshort nx, GLshort ny, GLshort nz);
typedef void (APIENTRYP PFNDOLINDEXDPROC) ( GLdouble c ); typedef void(APIENTRYP PFNDOLNORMAL3BVPROC)(const GLbyte* v);
typedef void (APIENTRYP PFNDOLINDEXFPROC) ( GLfloat c ); typedef void(APIENTRYP PFNDOLNORMAL3DVPROC)(const GLdouble* v);
typedef void (APIENTRYP PFNDOLINDEXIPROC) ( GLint c ); typedef void(APIENTRYP PFNDOLNORMAL3FVPROC)(const GLfloat* v);
typedef void (APIENTRYP PFNDOLINDEXSPROC) ( GLshort c ); typedef void(APIENTRYP PFNDOLNORMAL3IVPROC)(const GLint* v);
typedef void (APIENTRYP PFNDOLINDEXUBPROC) ( GLubyte c ); /* 1.1 */ typedef void(APIENTRYP PFNDOLNORMAL3SVPROC)(const GLshort* v);
typedef void (APIENTRYP PFNDOLINDEXDVPROC) ( const GLdouble *c ); typedef void(APIENTRYP PFNDOLINDEXDPROC)(GLdouble c);
typedef void (APIENTRYP PFNDOLINDEXFVPROC) ( const GLfloat *c ); typedef void(APIENTRYP PFNDOLINDEXFPROC)(GLfloat c);
typedef void (APIENTRYP PFNDOLINDEXIVPROC) ( const GLint *c ); typedef void(APIENTRYP PFNDOLINDEXIPROC)(GLint c);
typedef void (APIENTRYP PFNDOLINDEXSVPROC) ( const GLshort *c ); typedef void(APIENTRYP PFNDOLINDEXSPROC)(GLshort c);
typedef void (APIENTRYP PFNDOLINDEXUBVPROC) ( const GLubyte *c ); /* 1.1 */ typedef void(APIENTRYP PFNDOLINDEXUBPROC)(GLubyte c); /* 1.1 */
typedef void (APIENTRYP PFNDOLCOLOR3BPROC) ( GLbyte red, GLbyte green, GLbyte blue ); typedef void(APIENTRYP PFNDOLINDEXDVPROC)(const GLdouble* c);
typedef void (APIENTRYP PFNDOLCOLOR3DPROC) ( GLdouble red, GLdouble green, GLdouble blue ); typedef void(APIENTRYP PFNDOLINDEXFVPROC)(const GLfloat* c);
typedef void (APIENTRYP PFNDOLCOLOR3FPROC) ( GLfloat red, GLfloat green, GLfloat blue ); typedef void(APIENTRYP PFNDOLINDEXIVPROC)(const GLint* c);
typedef void (APIENTRYP PFNDOLCOLOR3IPROC) ( GLint red, GLint green, GLint blue ); typedef void(APIENTRYP PFNDOLINDEXSVPROC)(const GLshort* c);
typedef void (APIENTRYP PFNDOLCOLOR3SPROC) ( GLshort red, GLshort green, GLshort blue ); typedef void(APIENTRYP PFNDOLINDEXUBVPROC)(const GLubyte* c); /* 1.1 */
typedef void (APIENTRYP PFNDOLCOLOR3UBPROC) ( GLubyte red, GLubyte green, GLubyte blue ); typedef void(APIENTRYP PFNDOLCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue);
typedef void (APIENTRYP PFNDOLCOLOR3UIPROC) ( GLuint red, GLuint green, GLuint blue ); typedef void(APIENTRYP PFNDOLCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue);
typedef void (APIENTRYP PFNDOLCOLOR3USPROC) ( GLushort red, GLushort green, GLushort blue ); typedef void(APIENTRYP PFNDOLCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue);
typedef void (APIENTRYP PFNDOLCOLOR4BPROC) ( GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha ); typedef void(APIENTRYP PFNDOLCOLOR3IPROC)(GLint red, GLint green, GLint blue);
typedef void (APIENTRYP PFNDOLCOLOR4DPROC) ( GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha ); typedef void(APIENTRYP PFNDOLCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue);
typedef void (APIENTRYP PFNDOLCOLOR4FPROC) ( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); typedef void(APIENTRYP PFNDOLCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue);
typedef void (APIENTRYP PFNDOLCOLOR4IPROC) ( GLint red, GLint green, GLint blue, GLint alpha ); typedef void(APIENTRYP PFNDOLCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue);
typedef void (APIENTRYP PFNDOLCOLOR4SPROC) ( GLshort red, GLshort green, GLshort blue, GLshort alpha ); typedef void(APIENTRYP PFNDOLCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue);
typedef void (APIENTRYP PFNDOLCOLOR4UBPROC) ( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha ); typedef void(APIENTRYP PFNDOLCOLOR4BPROC)(GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha);
typedef void (APIENTRYP PFNDOLCOLOR4UIPROC) ( GLuint red, GLuint green, GLuint blue, GLuint alpha ); typedef void(APIENTRYP PFNDOLCOLOR4DPROC)(GLdouble red, GLdouble green, GLdouble blue,
typedef void (APIENTRYP PFNDOLCOLOR4USPROC) ( GLushort red, GLushort green, GLushort blue, GLushort alpha ); GLdouble alpha);
typedef void (APIENTRYP PFNDOLCOLOR3BVPROC) ( const GLbyte *v ); typedef void(APIENTRYP PFNDOLCOLOR4FPROC)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
typedef void (APIENTRYP PFNDOLCOLOR3DVPROC) ( const GLdouble *v ); typedef void(APIENTRYP PFNDOLCOLOR4IPROC)(GLint red, GLint green, GLint blue, GLint alpha);
typedef void (APIENTRYP PFNDOLCOLOR3FVPROC) ( const GLfloat *v ); typedef void(APIENTRYP PFNDOLCOLOR4SPROC)(GLshort red, GLshort green, GLshort blue, GLshort alpha);
typedef void (APIENTRYP PFNDOLCOLOR3IVPROC) ( const GLint *v ); typedef void(APIENTRYP PFNDOLCOLOR4UBPROC)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
typedef void (APIENTRYP PFNDOLCOLOR3SVPROC) ( const GLshort *v ); typedef void(APIENTRYP PFNDOLCOLOR4UIPROC)(GLuint red, GLuint green, GLuint blue, GLuint alpha);
typedef void (APIENTRYP PFNDOLCOLOR3UBVPROC) ( const GLubyte *v ); typedef void(APIENTRYP PFNDOLCOLOR4USPROC)(GLushort red, GLushort green, GLushort blue,
typedef void (APIENTRYP PFNDOLCOLOR3UIVPROC) ( const GLuint *v ); GLushort alpha);
typedef void (APIENTRYP PFNDOLCOLOR3USVPROC) ( const GLushort *v ); typedef void(APIENTRYP PFNDOLCOLOR3BVPROC)(const GLbyte* v);
typedef void (APIENTRYP PFNDOLCOLOR4BVPROC) ( const GLbyte *v ); typedef void(APIENTRYP PFNDOLCOLOR3DVPROC)(const GLdouble* v);
typedef void (APIENTRYP PFNDOLCOLOR4DVPROC) ( const GLdouble *v ); typedef void(APIENTRYP PFNDOLCOLOR3FVPROC)(const GLfloat* v);
typedef void (APIENTRYP PFNDOLCOLOR4FVPROC) ( const GLfloat *v ); typedef void(APIENTRYP PFNDOLCOLOR3IVPROC)(const GLint* v);
typedef void (APIENTRYP PFNDOLCOLOR4IVPROC) ( const GLint *v ); typedef void(APIENTRYP PFNDOLCOLOR3SVPROC)(const GLshort* v);
typedef void (APIENTRYP PFNDOLCOLOR4SVPROC) ( const GLshort *v ); typedef void(APIENTRYP PFNDOLCOLOR3UBVPROC)(const GLubyte* v);
typedef void (APIENTRYP PFNDOLCOLOR4UBVPROC) ( const GLubyte *v ); typedef void(APIENTRYP PFNDOLCOLOR3UIVPROC)(const GLuint* v);
typedef void (APIENTRYP PFNDOLCOLOR4UIVPROC) ( const GLuint *v ); typedef void(APIENTRYP PFNDOLCOLOR3USVPROC)(const GLushort* v);
typedef void (APIENTRYP PFNDOLCOLOR4USVPROC) ( const GLushort *v ); typedef void(APIENTRYP PFNDOLCOLOR4BVPROC)(const GLbyte* v);
typedef void (APIENTRYP PFNDOLTEXCOORD1DPROC) ( GLdouble s ); typedef void(APIENTRYP PFNDOLCOLOR4DVPROC)(const GLdouble* v);
typedef void (APIENTRYP PFNDOLTEXCOORD1FPROC) ( GLfloat s ); typedef void(APIENTRYP PFNDOLCOLOR4FVPROC)(const GLfloat* v);
typedef void (APIENTRYP PFNDOLTEXCOORD1IPROC) ( GLint s ); typedef void(APIENTRYP PFNDOLCOLOR4IVPROC)(const GLint* v);
typedef void (APIENTRYP PFNDOLTEXCOORD1SPROC) ( GLshort s ); typedef void(APIENTRYP PFNDOLCOLOR4SVPROC)(const GLshort* v);
typedef void (APIENTRYP PFNDOLTEXCOORD2DPROC) ( GLdouble s, GLdouble t ); typedef void(APIENTRYP PFNDOLCOLOR4UBVPROC)(const GLubyte* v);
typedef void (APIENTRYP PFNDOLTEXCOORD2FPROC) ( GLfloat s, GLfloat t ); typedef void(APIENTRYP PFNDOLCOLOR4UIVPROC)(const GLuint* v);
typedef void (APIENTRYP PFNDOLTEXCOORD2IPROC) ( GLint s, GLint t ); typedef void(APIENTRYP PFNDOLCOLOR4USVPROC)(const GLushort* v);
typedef void (APIENTRYP PFNDOLTEXCOORD2SPROC) ( GLshort s, GLshort t ); typedef void(APIENTRYP PFNDOLTEXCOORD1DPROC)(GLdouble s);
typedef void (APIENTRYP PFNDOLTEXCOORD3DPROC) ( GLdouble s, GLdouble t, GLdouble r ); typedef void(APIENTRYP PFNDOLTEXCOORD1FPROC)(GLfloat s);
typedef void (APIENTRYP PFNDOLTEXCOORD3FPROC) ( GLfloat s, GLfloat t, GLfloat r ); typedef void(APIENTRYP PFNDOLTEXCOORD1IPROC)(GLint s);
typedef void (APIENTRYP PFNDOLTEXCOORD3IPROC) ( GLint s, GLint t, GLint r ); typedef void(APIENTRYP PFNDOLTEXCOORD1SPROC)(GLshort s);
typedef void (APIENTRYP PFNDOLTEXCOORD3SPROC) ( GLshort s, GLshort t, GLshort r ); typedef void(APIENTRYP PFNDOLTEXCOORD2DPROC)(GLdouble s, GLdouble t);
typedef void (APIENTRYP PFNDOLTEXCOORD4DPROC) ( GLdouble s, GLdouble t, GLdouble r, GLdouble q ); typedef void(APIENTRYP PFNDOLTEXCOORD2FPROC)(GLfloat s, GLfloat t);
typedef void (APIENTRYP PFNDOLTEXCOORD4FPROC) ( GLfloat s, GLfloat t, GLfloat r, GLfloat q ); typedef void(APIENTRYP PFNDOLTEXCOORD2IPROC)(GLint s, GLint t);
typedef void (APIENTRYP PFNDOLTEXCOORD4IPROC) ( GLint s, GLint t, GLint r, GLint q ); typedef void(APIENTRYP PFNDOLTEXCOORD2SPROC)(GLshort s, GLshort t);
typedef void (APIENTRYP PFNDOLTEXCOORD4SPROC) ( GLshort s, GLshort t, GLshort r, GLshort q ); typedef void(APIENTRYP PFNDOLTEXCOORD3DPROC)(GLdouble s, GLdouble t, GLdouble r);
typedef void (APIENTRYP PFNDOLTEXCOORD1DVPROC) ( const GLdouble *v ); typedef void(APIENTRYP PFNDOLTEXCOORD3FPROC)(GLfloat s, GLfloat t, GLfloat r);
typedef void (APIENTRYP PFNDOLTEXCOORD1FVPROC) ( const GLfloat *v ); typedef void(APIENTRYP PFNDOLTEXCOORD3IPROC)(GLint s, GLint t, GLint r);
typedef void (APIENTRYP PFNDOLTEXCOORD1IVPROC) ( const GLint *v ); typedef void(APIENTRYP PFNDOLTEXCOORD3SPROC)(GLshort s, GLshort t, GLshort r);
typedef void (APIENTRYP PFNDOLTEXCOORD1SVPROC) ( const GLshort *v ); typedef void(APIENTRYP PFNDOLTEXCOORD4DPROC)(GLdouble s, GLdouble t, GLdouble r, GLdouble q);
typedef void (APIENTRYP PFNDOLTEXCOORD2DVPROC) ( const GLdouble *v ); typedef void(APIENTRYP PFNDOLTEXCOORD4FPROC)(GLfloat s, GLfloat t, GLfloat r, GLfloat q);
typedef void (APIENTRYP PFNDOLTEXCOORD2FVPROC) ( const GLfloat *v ); typedef void(APIENTRYP PFNDOLTEXCOORD4IPROC)(GLint s, GLint t, GLint r, GLint q);
typedef void (APIENTRYP PFNDOLTEXCOORD2IVPROC) ( const GLint *v ); typedef void(APIENTRYP PFNDOLTEXCOORD4SPROC)(GLshort s, GLshort t, GLshort r, GLshort q);
typedef void (APIENTRYP PFNDOLTEXCOORD2SVPROC) ( const GLshort *v ); typedef void(APIENTRYP PFNDOLTEXCOORD1DVPROC)(const GLdouble* v);
typedef void (APIENTRYP PFNDOLTEXCOORD3DVPROC) ( const GLdouble *v ); typedef void(APIENTRYP PFNDOLTEXCOORD1FVPROC)(const GLfloat* v);
typedef void (APIENTRYP PFNDOLTEXCOORD3FVPROC) ( const GLfloat *v ); typedef void(APIENTRYP PFNDOLTEXCOORD1IVPROC)(const GLint* v);
typedef void (APIENTRYP PFNDOLTEXCOORD3IVPROC) ( const GLint *v ); typedef void(APIENTRYP PFNDOLTEXCOORD1SVPROC)(const GLshort* v);
typedef void (APIENTRYP PFNDOLTEXCOORD3SVPROC) ( const GLshort *v ); typedef void(APIENTRYP PFNDOLTEXCOORD2DVPROC)(const GLdouble* v);
typedef void (APIENTRYP PFNDOLTEXCOORD4DVPROC) ( const GLdouble *v ); typedef void(APIENTRYP PFNDOLTEXCOORD2FVPROC)(const GLfloat* v);
typedef void (APIENTRYP PFNDOLTEXCOORD4FVPROC) ( const GLfloat *v ); typedef void(APIENTRYP PFNDOLTEXCOORD2IVPROC)(const GLint* v);
typedef void (APIENTRYP PFNDOLTEXCOORD4IVPROC) ( const GLint *v ); typedef void(APIENTRYP PFNDOLTEXCOORD2SVPROC)(const GLshort* v);
typedef void (APIENTRYP PFNDOLTEXCOORD4SVPROC) ( const GLshort *v ); typedef void(APIENTRYP PFNDOLTEXCOORD3DVPROC)(const GLdouble* v);
typedef void (APIENTRYP PFNDOLRASTERPOS2DPROC) ( GLdouble x, GLdouble y ); typedef void(APIENTRYP PFNDOLTEXCOORD3FVPROC)(const GLfloat* v);
typedef void (APIENTRYP PFNDOLRASTERPOS2FPROC) ( GLfloat x, GLfloat y ); typedef void(APIENTRYP PFNDOLTEXCOORD3IVPROC)(const GLint* v);
typedef void (APIENTRYP PFNDOLRASTERPOS2IPROC) ( GLint x, GLint y ); typedef void(APIENTRYP PFNDOLTEXCOORD3SVPROC)(const GLshort* v);
typedef void (APIENTRYP PFNDOLRASTERPOS2SPROC) ( GLshort x, GLshort y ); typedef void(APIENTRYP PFNDOLTEXCOORD4DVPROC)(const GLdouble* v);
typedef void (APIENTRYP PFNDOLRASTERPOS3DPROC) ( GLdouble x, GLdouble y, GLdouble z ); typedef void(APIENTRYP PFNDOLTEXCOORD4FVPROC)(const GLfloat* v);
typedef void (APIENTRYP PFNDOLRASTERPOS3FPROC) ( GLfloat x, GLfloat y, GLfloat z ); typedef void(APIENTRYP PFNDOLTEXCOORD4IVPROC)(const GLint* v);
typedef void (APIENTRYP PFNDOLRASTERPOS3IPROC) ( GLint x, GLint y, GLint z ); typedef void(APIENTRYP PFNDOLTEXCOORD4SVPROC)(const GLshort* v);
typedef void (APIENTRYP PFNDOLRASTERPOS3SPROC) ( GLshort x, GLshort y, GLshort z ); typedef void(APIENTRYP PFNDOLRASTERPOS2DPROC)(GLdouble x, GLdouble y);
typedef void (APIENTRYP PFNDOLRASTERPOS4DPROC) ( GLdouble x, GLdouble y, GLdouble z, GLdouble w ); typedef void(APIENTRYP PFNDOLRASTERPOS2FPROC)(GLfloat x, GLfloat y);
typedef void (APIENTRYP PFNDOLRASTERPOS4FPROC) ( GLfloat x, GLfloat y, GLfloat z, GLfloat w ); typedef void(APIENTRYP PFNDOLRASTERPOS2IPROC)(GLint x, GLint y);
typedef void (APIENTRYP PFNDOLRASTERPOS4IPROC) ( GLint x, GLint y, GLint z, GLint w ); typedef void(APIENTRYP PFNDOLRASTERPOS2SPROC)(GLshort x, GLshort y);
typedef void (APIENTRYP PFNDOLRASTERPOS4SPROC) ( GLshort x, GLshort y, GLshort z, GLshort w ); typedef void(APIENTRYP PFNDOLRASTERPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z);
typedef void (APIENTRYP PFNDOLRASTERPOS2DVPROC) ( const GLdouble *v ); typedef void(APIENTRYP PFNDOLRASTERPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z);
typedef void (APIENTRYP PFNDOLRASTERPOS2FVPROC) ( const GLfloat *v ); typedef void(APIENTRYP PFNDOLRASTERPOS3IPROC)(GLint x, GLint y, GLint z);
typedef void (APIENTRYP PFNDOLRASTERPOS2IVPROC) ( const GLint *v ); typedef void(APIENTRYP PFNDOLRASTERPOS3SPROC)(GLshort x, GLshort y, GLshort z);
typedef void (APIENTRYP PFNDOLRASTERPOS2SVPROC) ( const GLshort *v ); typedef void(APIENTRYP PFNDOLRASTERPOS4DPROC)(GLdouble x, GLdouble y, GLdouble z, GLdouble w);
typedef void (APIENTRYP PFNDOLRASTERPOS3DVPROC) ( const GLdouble *v ); typedef void(APIENTRYP PFNDOLRASTERPOS4FPROC)(GLfloat x, GLfloat y, GLfloat z, GLfloat w);
typedef void (APIENTRYP PFNDOLRASTERPOS3FVPROC) ( const GLfloat *v ); typedef void(APIENTRYP PFNDOLRASTERPOS4IPROC)(GLint x, GLint y, GLint z, GLint w);
typedef void (APIENTRYP PFNDOLRASTERPOS3IVPROC) ( const GLint *v ); typedef void(APIENTRYP PFNDOLRASTERPOS4SPROC)(GLshort x, GLshort y, GLshort z, GLshort w);
typedef void (APIENTRYP PFNDOLRASTERPOS3SVPROC) ( const GLshort *v ); typedef void(APIENTRYP PFNDOLRASTERPOS2DVPROC)(const GLdouble* v);
typedef void (APIENTRYP PFNDOLRASTERPOS4DVPROC) ( const GLdouble *v ); typedef void(APIENTRYP PFNDOLRASTERPOS2FVPROC)(const GLfloat* v);
typedef void (APIENTRYP PFNDOLRASTERPOS4FVPROC) ( const GLfloat *v ); typedef void(APIENTRYP PFNDOLRASTERPOS2IVPROC)(const GLint* v);
typedef void (APIENTRYP PFNDOLRASTERPOS4IVPROC) ( const GLint *v ); typedef void(APIENTRYP PFNDOLRASTERPOS2SVPROC)(const GLshort* v);
typedef void (APIENTRYP PFNDOLRASTERPOS4SVPROC) ( const GLshort *v ); typedef void(APIENTRYP PFNDOLRASTERPOS3DVPROC)(const GLdouble* v);
typedef void (APIENTRYP PFNDOLRECTDPROC) ( GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2 ); typedef void(APIENTRYP PFNDOLRASTERPOS3FVPROC)(const GLfloat* v);
typedef void (APIENTRYP PFNDOLRECTFPROC) ( GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2 ); typedef void(APIENTRYP PFNDOLRASTERPOS3IVPROC)(const GLint* v);
typedef void (APIENTRYP PFNDOLRECTIPROC) ( GLint x1, GLint y1, GLint x2, GLint y2 ); typedef void(APIENTRYP PFNDOLRASTERPOS3SVPROC)(const GLshort* v);
typedef void (APIENTRYP PFNDOLRECTSPROC) ( GLshort x1, GLshort y1, GLshort x2, GLshort y2 ); typedef void(APIENTRYP PFNDOLRASTERPOS4DVPROC)(const GLdouble* v);
typedef void (APIENTRYP PFNDOLRECTDVPROC) ( const GLdouble *v1, const GLdouble *v2 ); typedef void(APIENTRYP PFNDOLRASTERPOS4FVPROC)(const GLfloat* v);
typedef void (APIENTRYP PFNDOLRECTFVPROC) ( const GLfloat *v1, const GLfloat *v2 ); typedef void(APIENTRYP PFNDOLRASTERPOS4IVPROC)(const GLint* v);
typedef void (APIENTRYP PFNDOLRECTIVPROC) ( const GLint *v1, const GLint *v2 ); typedef void(APIENTRYP PFNDOLRASTERPOS4SVPROC)(const GLshort* v);
typedef void (APIENTRYP PFNDOLRECTSVPROC) ( const GLshort *v1, const GLshort *v2 ); typedef void(APIENTRYP PFNDOLRECTDPROC)(GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2);
typedef void (APIENTRYP PFNDOLVERTEXPOINTERPROC) ( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ); typedef void(APIENTRYP PFNDOLRECTFPROC)(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2);
typedef void (APIENTRYP PFNDOLNORMALPOINTERPROC) ( GLenum type, GLsizei stride, const GLvoid *ptr ); typedef void(APIENTRYP PFNDOLRECTIPROC)(GLint x1, GLint y1, GLint x2, GLint y2);
typedef void (APIENTRYP PFNDOLCOLORPOINTERPROC) ( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ); typedef void(APIENTRYP PFNDOLRECTSPROC)(GLshort x1, GLshort y1, GLshort x2, GLshort y2);
typedef void (APIENTRYP PFNDOLINDEXPOINTERPROC) ( GLenum type, GLsizei stride, const GLvoid *ptr ); typedef void(APIENTRYP PFNDOLRECTDVPROC)(const GLdouble* v1, const GLdouble* v2);
typedef void (APIENTRYP PFNDOLTEXCOORDPOINTERPROC) ( GLint size, GLenum type, GLsizei stride, const GLvoid *ptr ); typedef void(APIENTRYP PFNDOLRECTFVPROC)(const GLfloat* v1, const GLfloat* v2);
typedef void (APIENTRYP PFNDOLEDGEFLAGPOINTERPROC) ( GLsizei stride, const GLvoid *ptr ); typedef void(APIENTRYP PFNDOLRECTIVPROC)(const GLint* v1, const GLint* v2);
typedef void (APIENTRYP PFNDOLGETPOINTERVPROC) ( GLenum pname, GLvoid **params ); typedef void(APIENTRYP PFNDOLRECTSVPROC)(const GLshort* v1, const GLshort* v2);
typedef void (APIENTRYP PFNDOLARRAYELEMENTPROC) ( GLint i ); typedef void(APIENTRYP PFNDOLVERTEXPOINTERPROC)(GLint size, GLenum type, GLsizei stride,
typedef void (APIENTRYP PFNDOLDRAWARRAYSPROC) ( GLenum mode, GLint first, GLsizei count ); const GLvoid* ptr);
typedef void (APIENTRYP PFNDOLDRAWELEMENTSPROC) ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ); typedef void(APIENTRYP PFNDOLNORMALPOINTERPROC)(GLenum type, GLsizei stride, const GLvoid* ptr);
typedef void (APIENTRYP PFNDOLINTERLEAVEDARRAYSPROC) ( GLenum format, GLsizei stride, const GLvoid *pointer ); typedef void(APIENTRYP PFNDOLCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride,
typedef void (APIENTRYP PFNDOLSHADEMODELPROC) ( GLenum mode ); const GLvoid* ptr);
typedef void (APIENTRYP PFNDOLLIGHTFPROC) ( GLenum light, GLenum pname, GLfloat param ); typedef void(APIENTRYP PFNDOLINDEXPOINTERPROC)(GLenum type, GLsizei stride, const GLvoid* ptr);
typedef void (APIENTRYP PFNDOLLIGHTIPROC) ( GLenum light, GLenum pname, GLint param ); typedef void(APIENTRYP PFNDOLTEXCOORDPOINTERPROC)(GLint size, GLenum type, GLsizei stride,
typedef void (APIENTRYP PFNDOLLIGHTFVPROC) ( GLenum light, GLenum pname, const GLfloat *params ); const GLvoid* ptr);
typedef void (APIENTRYP PFNDOLLIGHTIVPROC) ( GLenum light, GLenum pname, const GLint *params ); typedef void(APIENTRYP PFNDOLEDGEFLAGPOINTERPROC)(GLsizei stride, const GLvoid* ptr);
typedef void (APIENTRYP PFNDOLGETLIGHTFVPROC) ( GLenum light, GLenum pname, GLfloat *params ); typedef void(APIENTRYP PFNDOLGETPOINTERVPROC)(GLenum pname, GLvoid** params);
typedef void (APIENTRYP PFNDOLGETLIGHTIVPROC) ( GLenum light, GLenum pname, GLint *params ); typedef void(APIENTRYP PFNDOLARRAYELEMENTPROC)(GLint i);
typedef void (APIENTRYP PFNDOLLIGHTMODELFPROC) ( GLenum pname, GLfloat param ); typedef void(APIENTRYP PFNDOLDRAWARRAYSPROC)(GLenum mode, GLint first, GLsizei count);
typedef void (APIENTRYP PFNDOLLIGHTMODELIPROC) ( GLenum pname, GLint param ); typedef void(APIENTRYP PFNDOLDRAWELEMENTSPROC)(GLenum mode, GLsizei count, GLenum type,
typedef void (APIENTRYP PFNDOLLIGHTMODELFVPROC) ( GLenum pname, const GLfloat *params ); const GLvoid* indices);
typedef void (APIENTRYP PFNDOLLIGHTMODELIVPROC) ( GLenum pname, const GLint *params ); typedef void(APIENTRYP PFNDOLINTERLEAVEDARRAYSPROC)(GLenum format, GLsizei stride,
typedef void (APIENTRYP PFNDOLMATERIALFPROC) ( GLenum face, GLenum pname, GLfloat param ); const GLvoid* pointer);
typedef void (APIENTRYP PFNDOLMATERIALIPROC) ( GLenum face, GLenum pname, GLint param ); typedef void(APIENTRYP PFNDOLSHADEMODELPROC)(GLenum mode);
typedef void (APIENTRYP PFNDOLMATERIALFVPROC) ( GLenum face, GLenum pname, const GLfloat *params ); typedef void(APIENTRYP PFNDOLLIGHTFPROC)(GLenum light, GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNDOLMATERIALIVPROC) ( GLenum face, GLenum pname, const GLint *params ); typedef void(APIENTRYP PFNDOLLIGHTIPROC)(GLenum light, GLenum pname, GLint param);
typedef void (APIENTRYP PFNDOLGETMATERIALFVPROC) ( GLenum face, GLenum pname, GLfloat *params ); typedef void(APIENTRYP PFNDOLLIGHTFVPROC)(GLenum light, GLenum pname, const GLfloat* params);
typedef void (APIENTRYP PFNDOLGETMATERIALIVPROC) ( GLenum face, GLenum pname, GLint *params ); typedef void(APIENTRYP PFNDOLLIGHTIVPROC)(GLenum light, GLenum pname, const GLint* params);
typedef void (APIENTRYP PFNDOLCOLORMATERIALPROC) ( GLenum face, GLenum mode ); typedef void(APIENTRYP PFNDOLGETLIGHTFVPROC)(GLenum light, GLenum pname, GLfloat* params);
typedef void (APIENTRYP PFNDOLPIXELZOOMPROC) ( GLfloat xfactor, GLfloat yfactor ); typedef void(APIENTRYP PFNDOLGETLIGHTIVPROC)(GLenum light, GLenum pname, GLint* params);
typedef void (APIENTRYP PFNDOLPIXELSTOREFPROC) ( GLenum pname, GLfloat param ); typedef void(APIENTRYP PFNDOLLIGHTMODELFPROC)(GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNDOLPIXELSTOREIPROC) ( GLenum pname, GLint param ); typedef void(APIENTRYP PFNDOLLIGHTMODELIPROC)(GLenum pname, GLint param);
typedef void (APIENTRYP PFNDOLPIXELTRANSFERFPROC) ( GLenum pname, GLfloat param ); typedef void(APIENTRYP PFNDOLLIGHTMODELFVPROC)(GLenum pname, const GLfloat* params);
typedef void (APIENTRYP PFNDOLPIXELTRANSFERIPROC) ( GLenum pname, GLint param ); typedef void(APIENTRYP PFNDOLLIGHTMODELIVPROC)(GLenum pname, const GLint* params);
typedef void (APIENTRYP PFNDOLPIXELMAPFVPROC) ( GLenum map, GLsizei mapsize, const GLfloat *values ); typedef void(APIENTRYP PFNDOLMATERIALFPROC)(GLenum face, GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNDOLPIXELMAPUIVPROC) ( GLenum map, GLsizei mapsize, const GLuint *values ); typedef void(APIENTRYP PFNDOLMATERIALIPROC)(GLenum face, GLenum pname, GLint param);
typedef void (APIENTRYP PFNDOLPIXELMAPUSVPROC) ( GLenum map, GLsizei mapsize, const GLushort *values ); typedef void(APIENTRYP PFNDOLMATERIALFVPROC)(GLenum face, GLenum pname, const GLfloat* params);
typedef void (APIENTRYP PFNDOLGETPIXELMAPFVPROC) ( GLenum map, GLfloat *values ); typedef void(APIENTRYP PFNDOLMATERIALIVPROC)(GLenum face, GLenum pname, const GLint* params);
typedef void (APIENTRYP PFNDOLGETPIXELMAPUIVPROC) ( GLenum map, GLuint *values ); typedef void(APIENTRYP PFNDOLGETMATERIALFVPROC)(GLenum face, GLenum pname, GLfloat* params);
typedef void (APIENTRYP PFNDOLGETPIXELMAPUSVPROC) ( GLenum map, GLushort *values ); typedef void(APIENTRYP PFNDOLGETMATERIALIVPROC)(GLenum face, GLenum pname, GLint* params);
typedef void (APIENTRYP PFNDOLBITMAPPROC) ( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap ); typedef void(APIENTRYP PFNDOLCOLORMATERIALPROC)(GLenum face, GLenum mode);
typedef void (APIENTRYP PFNDOLREADPIXELSPROC) ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ); typedef void(APIENTRYP PFNDOLPIXELZOOMPROC)(GLfloat xfactor, GLfloat yfactor);
typedef void (APIENTRYP PFNDOLDRAWPIXELSPROC) ( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); typedef void(APIENTRYP PFNDOLPIXELSTOREFPROC)(GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNDOLCOPYPIXELSPROC) ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum type ); typedef void(APIENTRYP PFNDOLPIXELSTOREIPROC)(GLenum pname, GLint param);
typedef void (APIENTRYP PFNDOLSTENCILFUNCPROC) ( GLenum func, GLint ref, GLuint mask ); typedef void(APIENTRYP PFNDOLPIXELTRANSFERFPROC)(GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNDOLSTENCILMASKPROC) ( GLuint mask ); typedef void(APIENTRYP PFNDOLPIXELTRANSFERIPROC)(GLenum pname, GLint param);
typedef void (APIENTRYP PFNDOLSTENCILOPPROC) ( GLenum fail, GLenum zfail, GLenum zpass ); typedef void(APIENTRYP PFNDOLPIXELMAPFVPROC)(GLenum map, GLsizei mapsize, const GLfloat* values);
typedef void (APIENTRYP PFNDOLCLEARSTENCILPROC) ( GLint s ); typedef void(APIENTRYP PFNDOLPIXELMAPUIVPROC)(GLenum map, GLsizei mapsize, const GLuint* values);
typedef void (APIENTRYP PFNDOLTEXGENDPROC) ( GLenum coord, GLenum pname, GLdouble param ); typedef void(APIENTRYP PFNDOLPIXELMAPUSVPROC)(GLenum map, GLsizei mapsize, const GLushort* values);
typedef void (APIENTRYP PFNDOLTEXGENFPROC) ( GLenum coord, GLenum pname, GLfloat param ); typedef void(APIENTRYP PFNDOLGETPIXELMAPFVPROC)(GLenum map, GLfloat* values);
typedef void (APIENTRYP PFNDOLTEXGENIPROC) ( GLenum coord, GLenum pname, GLint param ); typedef void(APIENTRYP PFNDOLGETPIXELMAPUIVPROC)(GLenum map, GLuint* values);
typedef void (APIENTRYP PFNDOLTEXGENDVPROC) ( GLenum coord, GLenum pname, const GLdouble *params ); typedef void(APIENTRYP PFNDOLGETPIXELMAPUSVPROC)(GLenum map, GLushort* values);
typedef void (APIENTRYP PFNDOLTEXGENFVPROC) ( GLenum coord, GLenum pname, const GLfloat *params ); typedef void(APIENTRYP PFNDOLBITMAPPROC)(GLsizei width, GLsizei height, GLfloat xorig,
typedef void (APIENTRYP PFNDOLTEXGENIVPROC) ( GLenum coord, GLenum pname, const GLint *params ); GLfloat yorig, GLfloat xmove, GLfloat ymove,
typedef void (APIENTRYP PFNDOLGETTEXGENDVPROC) ( GLenum coord, GLenum pname, GLdouble *params ); const GLubyte* bitmap);
typedef void (APIENTRYP PFNDOLGETTEXGENFVPROC) ( GLenum coord, GLenum pname, GLfloat *params ); typedef void(APIENTRYP PFNDOLREADPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height,
typedef void (APIENTRYP PFNDOLGETTEXGENIVPROC) ( GLenum coord, GLenum pname, GLint *params ); GLenum format, GLenum type, GLvoid* pixels);
typedef void (APIENTRYP PFNDOLTEXENVFPROC) ( GLenum target, GLenum pname, GLfloat param ); typedef void(APIENTRYP PFNDOLDRAWPIXELSPROC)(GLsizei width, GLsizei height, GLenum format,
typedef void (APIENTRYP PFNDOLTEXENVIPROC) ( GLenum target, GLenum pname, GLint param ); GLenum type, const GLvoid* pixels);
typedef void (APIENTRYP PFNDOLTEXENVFVPROC) ( GLenum target, GLenum pname, const GLfloat *params ); typedef void(APIENTRYP PFNDOLCOPYPIXELSPROC)(GLint x, GLint y, GLsizei width, GLsizei height,
typedef void (APIENTRYP PFNDOLTEXENVIVPROC) ( GLenum target, GLenum pname, const GLint *params ); GLenum type);
typedef void (APIENTRYP PFNDOLGETTEXENVFVPROC) ( GLenum target, GLenum pname, GLfloat *params ); typedef void(APIENTRYP PFNDOLSTENCILFUNCPROC)(GLenum func, GLint ref, GLuint mask);
typedef void (APIENTRYP PFNDOLGETTEXENVIVPROC) ( GLenum target, GLenum pname, GLint *params ); typedef void(APIENTRYP PFNDOLSTENCILMASKPROC)(GLuint mask);
typedef void (APIENTRYP PFNDOLTEXPARAMETERFPROC) ( GLenum target, GLenum pname, GLfloat param ); typedef void(APIENTRYP PFNDOLSTENCILOPPROC)(GLenum fail, GLenum zfail, GLenum zpass);
typedef void (APIENTRYP PFNDOLTEXPARAMETERIPROC) ( GLenum target, GLenum pname, GLint param ); typedef void(APIENTRYP PFNDOLCLEARSTENCILPROC)(GLint s);
typedef void (APIENTRYP PFNDOLTEXPARAMETERFVPROC) ( GLenum target, GLenum pname, const GLfloat *params ); typedef void(APIENTRYP PFNDOLTEXGENDPROC)(GLenum coord, GLenum pname, GLdouble param);
typedef void (APIENTRYP PFNDOLTEXPARAMETERIVPROC) ( GLenum target, GLenum pname, const GLint *params ); typedef void(APIENTRYP PFNDOLTEXGENFPROC)(GLenum coord, GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNDOLGETTEXPARAMETERFVPROC) ( GLenum target, GLenum pname, GLfloat *params); typedef void(APIENTRYP PFNDOLTEXGENIPROC)(GLenum coord, GLenum pname, GLint param);
typedef void (APIENTRYP PFNDOLGETTEXPARAMETERIVPROC) ( GLenum target, GLenum pname, GLint *params ); typedef void(APIENTRYP PFNDOLTEXGENDVPROC)(GLenum coord, GLenum pname, const GLdouble* params);
typedef void (APIENTRYP PFNDOLGETTEXLEVELPARAMETERFVPROC) ( GLenum target, GLint level, GLenum pname, GLfloat *params ); typedef void(APIENTRYP PFNDOLTEXGENFVPROC)(GLenum coord, GLenum pname, const GLfloat* params);
typedef void (APIENTRYP PFNDOLGETTEXLEVELPARAMETERIVPROC) ( GLenum target, GLint level, GLenum pname, GLint *params ); typedef void(APIENTRYP PFNDOLTEXGENIVPROC)(GLenum coord, GLenum pname, const GLint* params);
typedef void (APIENTRYP PFNDOLTEXIMAGE1DPROC) ( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); typedef void(APIENTRYP PFNDOLGETTEXGENDVPROC)(GLenum coord, GLenum pname, GLdouble* params);
typedef void (APIENTRYP PFNDOLTEXIMAGE2DPROC) ( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ); typedef void(APIENTRYP PFNDOLGETTEXGENFVPROC)(GLenum coord, GLenum pname, GLfloat* params);
typedef void (APIENTRYP PFNDOLGETTEXIMAGEPROC) ( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels ); typedef void(APIENTRYP PFNDOLGETTEXGENIVPROC)(GLenum coord, GLenum pname, GLint* params);
typedef void (APIENTRYP PFNDOLGENTEXTURESPROC) ( GLsizei n, GLuint *textures ); typedef void(APIENTRYP PFNDOLTEXENVFPROC)(GLenum target, GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNDOLDELETETEXTURESPROC) ( GLsizei n, const GLuint *textures); typedef void(APIENTRYP PFNDOLTEXENVIPROC)(GLenum target, GLenum pname, GLint param);
typedef void (APIENTRYP PFNDOLBINDTEXTUREPROC) ( GLenum target, GLuint texture ); typedef void(APIENTRYP PFNDOLTEXENVFVPROC)(GLenum target, GLenum pname, const GLfloat* params);
typedef void (APIENTRYP PFNDOLPRIORITIZETEXTURESPROC) ( GLsizei n, const GLuint *textures, const GLclampf *priorities ); typedef void(APIENTRYP PFNDOLTEXENVIVPROC)(GLenum target, GLenum pname, const GLint* params);
typedef GLboolean (APIENTRYP PFNDOLARETEXTURESRESIDENTPROC) ( GLsizei n, const GLuint *textures, GLboolean *residences ); typedef void(APIENTRYP PFNDOLGETTEXENVFVPROC)(GLenum target, GLenum pname, GLfloat* params);
typedef GLboolean (APIENTRYP PFNDOLISTEXTUREPROC) ( GLuint texture ); typedef void(APIENTRYP PFNDOLGETTEXENVIVPROC)(GLenum target, GLenum pname, GLint* params);
typedef void (APIENTRYP PFNDOLTEXSUBIMAGE1DPROC) ( GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels ); typedef void(APIENTRYP PFNDOLTEXPARAMETERFPROC)(GLenum target, GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNDOLTEXSUBIMAGE2DPROC) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); typedef void(APIENTRYP PFNDOLTEXPARAMETERIPROC)(GLenum target, GLenum pname, GLint param);
typedef void (APIENTRYP PFNDOLCOPYTEXIMAGE1DPROC) ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border ); typedef void(APIENTRYP PFNDOLTEXPARAMETERFVPROC)(GLenum target, GLenum pname,
typedef void (APIENTRYP PFNDOLCOPYTEXIMAGE2DPROC) ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ); const GLfloat* params);
typedef void (APIENTRYP PFNDOLCOPYTEXSUBIMAGE1DPROC) ( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ); typedef void(APIENTRYP PFNDOLTEXPARAMETERIVPROC)(GLenum target, GLenum pname, const GLint* params);
typedef void (APIENTRYP PFNDOLCOPYTEXSUBIMAGE2DPROC) ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ); typedef void(APIENTRYP PFNDOLGETTEXPARAMETERFVPROC)(GLenum target, GLenum pname, GLfloat* params);
typedef void (APIENTRYP PFNDOLMAP1DPROC) ( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points ); typedef void(APIENTRYP PFNDOLGETTEXPARAMETERIVPROC)(GLenum target, GLenum pname, GLint* params);
typedef void (APIENTRYP PFNDOLMAP1FPROC) ( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points ); typedef void(APIENTRYP PFNDOLGETTEXLEVELPARAMETERFVPROC)(GLenum target, GLint level, GLenum pname,
typedef void (APIENTRYP PFNDOLMAP2DPROC) ( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points ); GLfloat* params);
typedef void (APIENTRYP PFNDOLMAP2FPROC) ( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points ); typedef void(APIENTRYP PFNDOLGETTEXLEVELPARAMETERIVPROC)(GLenum target, GLint level, GLenum pname,
typedef void (APIENTRYP PFNDOLGETMAPDVPROC) ( GLenum target, GLenum query, GLdouble *v ); GLint* params);
typedef void (APIENTRYP PFNDOLGETMAPFVPROC) ( GLenum target, GLenum query, GLfloat *v ); typedef void(APIENTRYP PFNDOLTEXIMAGE1DPROC)(GLenum target, GLint level, GLint internalFormat,
typedef void (APIENTRYP PFNDOLGETMAPIVPROC) ( GLenum target, GLenum query, GLint *v ); GLsizei width, GLint border, GLenum format,
typedef void (APIENTRYP PFNDOLEVALCOORD1DPROC) ( GLdouble u ); GLenum type, const GLvoid* pixels);
typedef void (APIENTRYP PFNDOLEVALCOORD1FPROC) ( GLfloat u ); typedef void(APIENTRYP PFNDOLTEXIMAGE2DPROC)(GLenum target, GLint level, GLint internalFormat,
typedef void (APIENTRYP PFNDOLEVALCOORD1DVPROC) ( const GLdouble *u ); GLsizei width, GLsizei height, GLint border,
typedef void (APIENTRYP PFNDOLEVALCOORD1FVPROC) ( const GLfloat *u ); GLenum format, GLenum type, const GLvoid* pixels);
typedef void (APIENTRYP PFNDOLEVALCOORD2DPROC) ( GLdouble u, GLdouble v ); typedef void(APIENTRYP PFNDOLGETTEXIMAGEPROC)(GLenum target, GLint level, GLenum format,
typedef void (APIENTRYP PFNDOLEVALCOORD2FPROC) ( GLfloat u, GLfloat v ); GLenum type, GLvoid* pixels);
typedef void (APIENTRYP PFNDOLEVALCOORD2DVPROC) ( const GLdouble *u ); typedef void(APIENTRYP PFNDOLGENTEXTURESPROC)(GLsizei n, GLuint* textures);
typedef void (APIENTRYP PFNDOLEVALCOORD2FVPROC) ( const GLfloat *u ); typedef void(APIENTRYP PFNDOLDELETETEXTURESPROC)(GLsizei n, const GLuint* textures);
typedef void (APIENTRYP PFNDOLMAPGRID1DPROC) ( GLint un, GLdouble u1, GLdouble u2 ); typedef void(APIENTRYP PFNDOLBINDTEXTUREPROC)(GLenum target, GLuint texture);
typedef void (APIENTRYP PFNDOLMAPGRID1FPROC) ( GLint un, GLfloat u1, GLfloat u2 ); typedef void(APIENTRYP PFNDOLPRIORITIZETEXTURESPROC)(GLsizei n, const GLuint* textures,
typedef void (APIENTRYP PFNDOLMAPGRID2DPROC) ( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ); const GLclampf* priorities);
typedef void (APIENTRYP PFNDOLMAPGRID2FPROC) ( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ); typedef GLboolean(APIENTRYP PFNDOLARETEXTURESRESIDENTPROC)(GLsizei n, const GLuint* textures,
typedef void (APIENTRYP PFNDOLEVALPOINT1PROC) ( GLint i ); GLboolean* residences);
typedef void (APIENTRYP PFNDOLEVALPOINT2PROC) ( GLint i, GLint j ); typedef GLboolean(APIENTRYP PFNDOLISTEXTUREPROC)(GLuint texture);
typedef void (APIENTRYP PFNDOLEVALMESH1PROC) ( GLenum mode, GLint i1, GLint i2 ); typedef void(APIENTRYP PFNDOLTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset,
typedef void (APIENTRYP PFNDOLEVALMESH2PROC) ( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ); GLsizei width, GLenum format, GLenum type,
typedef void (APIENTRYP PFNDOLFOGFPROC) ( GLenum pname, GLfloat param ); const GLvoid* pixels);
typedef void (APIENTRYP PFNDOLFOGIPROC) ( GLenum pname, GLint param ); typedef void(APIENTRYP PFNDOLTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset,
typedef void (APIENTRYP PFNDOLFOGFVPROC) ( GLenum pname, const GLfloat *params ); GLint yoffset, GLsizei width, GLsizei height,
typedef void (APIENTRYP PFNDOLFOGIVPROC) ( GLenum pname, const GLint *params ); GLenum format, GLenum type, const GLvoid* pixels);
typedef void (APIENTRYP PFNDOLFEEDBACKBUFFERPROC) ( GLsizei size, GLenum type, GLfloat *buffer ); typedef void(APIENTRYP PFNDOLCOPYTEXIMAGE1DPROC)(GLenum target, GLint level, GLenum internalformat,
typedef void (APIENTRYP PFNDOLPASSTHROUGHPROC) ( GLfloat token ); GLint x, GLint y, GLsizei width, GLint border);
typedef void (APIENTRYP PFNDOLSELECTBUFFERPROC) ( GLsizei size, GLuint *buffer ); typedef void(APIENTRYP PFNDOLCOPYTEXIMAGE2DPROC)(GLenum target, GLint level, GLenum internalformat,
typedef void (APIENTRYP PFNDOLINITNAMESPROC) ( void ); GLint x, GLint y, GLsizei width, GLsizei height,
typedef void (APIENTRYP PFNDOLLOADNAMEPROC) ( GLuint name ); GLint border);
typedef void (APIENTRYP PFNDOLPUSHNAMEPROC) ( GLuint name ); typedef void(APIENTRYP PFNDOLCOPYTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset,
typedef void (APIENTRYP PFNDOLPOPNAMEPROC) ( void ); GLint x, GLint y, GLsizei width);
typedef void(APIENTRYP PFNDOLCOPYTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset,
GLint yoffset, GLint x, GLint y, GLsizei width,
GLsizei height);
typedef void(APIENTRYP PFNDOLMAP1DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint stride,
GLint order, const GLdouble* points);
typedef void(APIENTRYP PFNDOLMAP1FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint stride,
GLint order, const GLfloat* points);
typedef void(APIENTRYP PFNDOLMAP2DPROC)(GLenum target, GLdouble u1, GLdouble u2, GLint ustride,
GLint uorder, GLdouble v1, GLdouble v2, GLint vstride,
GLint vorder, const GLdouble* points);
typedef void(APIENTRYP PFNDOLMAP2FPROC)(GLenum target, GLfloat u1, GLfloat u2, GLint ustride,
GLint uorder, GLfloat v1, GLfloat v2, GLint vstride,
GLint vorder, const GLfloat* points);
typedef void(APIENTRYP PFNDOLGETMAPDVPROC)(GLenum target, GLenum query, GLdouble* v);
typedef void(APIENTRYP PFNDOLGETMAPFVPROC)(GLenum target, GLenum query, GLfloat* v);
typedef void(APIENTRYP PFNDOLGETMAPIVPROC)(GLenum target, GLenum query, GLint* v);
typedef void(APIENTRYP PFNDOLEVALCOORD1DPROC)(GLdouble u);
typedef void(APIENTRYP PFNDOLEVALCOORD1FPROC)(GLfloat u);
typedef void(APIENTRYP PFNDOLEVALCOORD1DVPROC)(const GLdouble* u);
typedef void(APIENTRYP PFNDOLEVALCOORD1FVPROC)(const GLfloat* u);
typedef void(APIENTRYP PFNDOLEVALCOORD2DPROC)(GLdouble u, GLdouble v);
typedef void(APIENTRYP PFNDOLEVALCOORD2FPROC)(GLfloat u, GLfloat v);
typedef void(APIENTRYP PFNDOLEVALCOORD2DVPROC)(const GLdouble* u);
typedef void(APIENTRYP PFNDOLEVALCOORD2FVPROC)(const GLfloat* u);
typedef void(APIENTRYP PFNDOLMAPGRID1DPROC)(GLint un, GLdouble u1, GLdouble u2);
typedef void(APIENTRYP PFNDOLMAPGRID1FPROC)(GLint un, GLfloat u1, GLfloat u2);
typedef void(APIENTRYP PFNDOLMAPGRID2DPROC)(GLint un, GLdouble u1, GLdouble u2, GLint vn,
GLdouble v1, GLdouble v2);
typedef void(APIENTRYP PFNDOLMAPGRID2FPROC)(GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1,
GLfloat v2);
typedef void(APIENTRYP PFNDOLEVALPOINT1PROC)(GLint i);
typedef void(APIENTRYP PFNDOLEVALPOINT2PROC)(GLint i, GLint j);
typedef void(APIENTRYP PFNDOLEVALMESH1PROC)(GLenum mode, GLint i1, GLint i2);
typedef void(APIENTRYP PFNDOLEVALMESH2PROC)(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2);
typedef void(APIENTRYP PFNDOLFOGFPROC)(GLenum pname, GLfloat param);
typedef void(APIENTRYP PFNDOLFOGIPROC)(GLenum pname, GLint param);
typedef void(APIENTRYP PFNDOLFOGFVPROC)(GLenum pname, const GLfloat* params);
typedef void(APIENTRYP PFNDOLFOGIVPROC)(GLenum pname, const GLint* params);
typedef void(APIENTRYP PFNDOLFEEDBACKBUFFERPROC)(GLsizei size, GLenum type, GLfloat* buffer);
typedef void(APIENTRYP PFNDOLPASSTHROUGHPROC)(GLfloat token);
typedef void(APIENTRYP PFNDOLSELECTBUFFERPROC)(GLsizei size, GLuint* buffer);
typedef void(APIENTRYP PFNDOLINITNAMESPROC)(void);
typedef void(APIENTRYP PFNDOLLOADNAMEPROC)(GLuint name);
typedef void(APIENTRYP PFNDOLPUSHNAMEPROC)(GLuint name);
typedef void(APIENTRYP PFNDOLPOPNAMEPROC)(void);
extern PFNDOLCLEARINDEXPROC dolClearIndex; extern PFNDOLCLEARINDEXPROC dolClearIndex;
extern PFNDOLCLEARCOLORPROC dolClearColor; extern PFNDOLCLEARCOLORPROC dolClearColor;

View File

@ -65,10 +65,20 @@
#define GL_MAX_3D_TEXTURE_SIZE 0x8073 #define GL_MAX_3D_TEXTURE_SIZE 0x8073
#define GL_TEXTURE_BINDING_3D 0x806A #define GL_TEXTURE_BINDING_3D 0x806A
typedef void (APIENTRYP PFNDOLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices); typedef void(APIENTRYP PFNDOLDRAWRANGEELEMENTSPROC)(GLenum mode, GLuint start, GLuint end,
typedef void (APIENTRYP PFNDOLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); GLsizei count, GLenum type,
typedef void (APIENTRYP PFNDOLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); const GLvoid* indices);
typedef void (APIENTRYP PFNDOLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); typedef void(APIENTRYP PFNDOLTEXIMAGE3DPROC)(GLenum target, GLint level, GLint internalformat,
GLsizei width, GLsizei height, GLsizei depth,
GLint border, GLenum format, GLenum type,
const GLvoid* pixels);
typedef void(APIENTRYP PFNDOLTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset,
GLint yoffset, GLint zoffset, GLsizei width,
GLsizei height, GLsizei depth, GLenum format,
GLenum type, const GLvoid* pixels);
typedef void(APIENTRYP PFNDOLCOPYTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset,
GLint yoffset, GLint zoffset, GLint x, GLint y,
GLsizei width, GLsizei height);
extern PFNDOLCOPYTEXSUBIMAGE3DPROC dolCopyTexSubImage3D; extern PFNDOLCOPYTEXSUBIMAGE3DPROC dolCopyTexSubImage3D;
extern PFNDOLDRAWRANGEELEMENTSPROC dolDrawRangeElements; extern PFNDOLDRAWRANGEELEMENTSPROC dolDrawRangeElements;

View File

@ -128,55 +128,80 @@
/* texture_border_clamp */ /* texture_border_clamp */
#define GL_CLAMP_TO_BORDER 0x812D #define GL_CLAMP_TO_BORDER 0x812D
typedef void (APIENTRYP PFNDOLACTIVETEXTUREPROC) (GLenum texture); typedef void(APIENTRYP PFNDOLACTIVETEXTUREPROC)(GLenum texture);
typedef void (APIENTRYP PFNDOLSAMPLECOVERAGEPROC) (GLclampf value, GLboolean invert); typedef void(APIENTRYP PFNDOLSAMPLECOVERAGEPROC)(GLclampf value, GLboolean invert);
typedef void (APIENTRYP PFNDOLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data); typedef void(APIENTRYP PFNDOLCOMPRESSEDTEXIMAGE3DPROC)(GLenum target, GLint level,
typedef void (APIENTRYP PFNDOLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); GLenum internalformat, GLsizei width,
typedef void (APIENTRYP PFNDOLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data); GLsizei height, GLsizei depth, GLint border,
typedef void (APIENTRYP PFNDOLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data); GLsizei imageSize, const GLvoid* data);
typedef void (APIENTRYP PFNDOLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); typedef void(APIENTRYP PFNDOLCOMPRESSEDTEXIMAGE2DPROC)(GLenum target, GLint level,
typedef void (APIENTRYP PFNDOLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data); GLenum internalformat, GLsizei width,
typedef void (APIENTRYP PFNDOLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, GLvoid *img); GLsizei height, GLint border,
GLsizei imageSize, const GLvoid* data);
typedef void(APIENTRYP PFNDOLCOMPRESSEDTEXIMAGE1DPROC)(GLenum target, GLint level,
GLenum internalformat, GLsizei width,
GLint border, GLsizei imageSize,
const GLvoid* data);
typedef void(APIENTRYP PFNDOLCOMPRESSEDTEXSUBIMAGE3DPROC)(GLenum target, GLint level, GLint xoffset,
GLint yoffset, GLint zoffset,
GLsizei width, GLsizei height,
GLsizei depth, GLenum format,
GLsizei imageSize, const GLvoid* data);
typedef void(APIENTRYP PFNDOLCOMPRESSEDTEXSUBIMAGE2DPROC)(GLenum target, GLint level, GLint xoffset,
GLint yoffset, GLsizei width,
GLsizei height, GLenum format,
GLsizei imageSize, const GLvoid* data);
typedef void(APIENTRYP PFNDOLCOMPRESSEDTEXSUBIMAGE1DPROC)(GLenum target, GLint level, GLint xoffset,
GLsizei width, GLenum format,
GLsizei imageSize, const GLvoid* data);
typedef void(APIENTRYP PFNDOLGETCOMPRESSEDTEXIMAGEPROC)(GLenum target, GLint level, GLvoid* img);
typedef void (APIENTRYP PFNDOLACTIVETEXTUREARBPROC) (GLenum texture); typedef void(APIENTRYP PFNDOLACTIVETEXTUREARBPROC)(GLenum texture);
typedef void (APIENTRYP PFNDOLCLIENTACTIVETEXTUREARBPROC) (GLenum texture); typedef void(APIENTRYP PFNDOLCLIENTACTIVETEXTUREARBPROC)(GLenum texture);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s); typedef void(APIENTRYP PFNDOLMULTITEXCOORD1DARBPROC)(GLenum target, GLdouble s);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v); typedef void(APIENTRYP PFNDOLMULTITEXCOORD1DVARBPROC)(GLenum target, const GLdouble* v);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s); typedef void(APIENTRYP PFNDOLMULTITEXCOORD1FARBPROC)(GLenum target, GLfloat s);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v); typedef void(APIENTRYP PFNDOLMULTITEXCOORD1FVARBPROC)(GLenum target, const GLfloat* v);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s); typedef void(APIENTRYP PFNDOLMULTITEXCOORD1IARBPROC)(GLenum target, GLint s);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v); typedef void(APIENTRYP PFNDOLMULTITEXCOORD1IVARBPROC)(GLenum target, const GLint* v);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s); typedef void(APIENTRYP PFNDOLMULTITEXCOORD1SARBPROC)(GLenum target, GLshort s);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v); typedef void(APIENTRYP PFNDOLMULTITEXCOORD1SVARBPROC)(GLenum target, const GLshort* v);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t); typedef void(APIENTRYP PFNDOLMULTITEXCOORD2DARBPROC)(GLenum target, GLdouble s, GLdouble t);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v); typedef void(APIENTRYP PFNDOLMULTITEXCOORD2DVARBPROC)(GLenum target, const GLdouble* v);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t); typedef void(APIENTRYP PFNDOLMULTITEXCOORD2FARBPROC)(GLenum target, GLfloat s, GLfloat t);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v); typedef void(APIENTRYP PFNDOLMULTITEXCOORD2FVARBPROC)(GLenum target, const GLfloat* v);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t); typedef void(APIENTRYP PFNDOLMULTITEXCOORD2IARBPROC)(GLenum target, GLint s, GLint t);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v); typedef void(APIENTRYP PFNDOLMULTITEXCOORD2IVARBPROC)(GLenum target, const GLint* v);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t); typedef void(APIENTRYP PFNDOLMULTITEXCOORD2SARBPROC)(GLenum target, GLshort s, GLshort t);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v); typedef void(APIENTRYP PFNDOLMULTITEXCOORD2SVARBPROC)(GLenum target, const GLshort* v);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r); typedef void(APIENTRYP PFNDOLMULTITEXCOORD3DARBPROC)(GLenum target, GLdouble s, GLdouble t,
typedef void (APIENTRYP PFNDOLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v); GLdouble r);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r); typedef void(APIENTRYP PFNDOLMULTITEXCOORD3DVARBPROC)(GLenum target, const GLdouble* v);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v); typedef void(APIENTRYP PFNDOLMULTITEXCOORD3FARBPROC)(GLenum target, GLfloat s, GLfloat t,
typedef void (APIENTRYP PFNDOLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r); GLfloat r);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v); typedef void(APIENTRYP PFNDOLMULTITEXCOORD3FVARBPROC)(GLenum target, const GLfloat* v);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r); typedef void(APIENTRYP PFNDOLMULTITEXCOORD3IARBPROC)(GLenum target, GLint s, GLint t, GLint r);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v); typedef void(APIENTRYP PFNDOLMULTITEXCOORD3IVARBPROC)(GLenum target, const GLint* v);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q); typedef void(APIENTRYP PFNDOLMULTITEXCOORD3SARBPROC)(GLenum target, GLshort s, GLshort t,
typedef void (APIENTRYP PFNDOLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v); GLshort r);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); typedef void(APIENTRYP PFNDOLMULTITEXCOORD3SVARBPROC)(GLenum target, const GLshort* v);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v); typedef void(APIENTRYP PFNDOLMULTITEXCOORD4DARBPROC)(GLenum target, GLdouble s, GLdouble t,
typedef void (APIENTRYP PFNDOLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q); GLdouble r, GLdouble q);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v); typedef void(APIENTRYP PFNDOLMULTITEXCOORD4DVARBPROC)(GLenum target, const GLdouble* v);
typedef void (APIENTRYP PFNDOLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q); typedef void(APIENTRYP PFNDOLMULTITEXCOORD4FARBPROC)(GLenum target, GLfloat s, GLfloat t, GLfloat r,
typedef void (APIENTRYP PFNDOLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v); GLfloat q);
typedef void (APIENTRYP PFNDOLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); typedef void(APIENTRYP PFNDOLMULTITEXCOORD4FVARBPROC)(GLenum target, const GLfloat* v);
typedef void (APIENTRYP PFNDOLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); typedef void(APIENTRYP PFNDOLMULTITEXCOORD4IARBPROC)(GLenum target, GLint s, GLint t, GLint r,
typedef void (APIENTRYP PFNDOLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m); GLint q);
typedef void (APIENTRYP PFNDOLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m); typedef void(APIENTRYP PFNDOLMULTITEXCOORD4IVARBPROC)(GLenum target, const GLint* v);
typedef void (APIENTRYP PFNDOLSAMPLECOVERAGEARBPROC) (GLfloat value, GLboolean invert); typedef void(APIENTRYP PFNDOLMULTITEXCOORD4SARBPROC)(GLenum target, GLshort s, GLshort t, GLshort r,
GLshort q);
typedef void(APIENTRYP PFNDOLMULTITEXCOORD4SVARBPROC)(GLenum target, const GLshort* v);
typedef void(APIENTRYP PFNDOLLOADTRANSPOSEMATRIXFARBPROC)(const GLfloat* m);
typedef void(APIENTRYP PFNDOLLOADTRANSPOSEMATRIXDARBPROC)(const GLdouble* m);
typedef void(APIENTRYP PFNDOLMULTTRANSPOSEMATRIXFARBPROC)(const GLfloat* m);
typedef void(APIENTRYP PFNDOLMULTTRANSPOSEMATRIXDARBPROC)(const GLdouble* m);
typedef void(APIENTRYP PFNDOLSAMPLECOVERAGEARBPROC)(GLfloat value, GLboolean invert);
extern PFNDOLACTIVETEXTUREARBPROC dolActiveTexture; extern PFNDOLACTIVETEXTUREARBPROC dolActiveTexture;
extern PFNDOLCLIENTACTIVETEXTUREARBPROC dolClientActiveTexture; extern PFNDOLCLIENTACTIVETEXTUREARBPROC dolClientActiveTexture;

View File

@ -72,53 +72,58 @@
#define GL_CONSTANT_ALPHA 0x8003 #define GL_CONSTANT_ALPHA 0x8003
#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 #define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
typedef void (APIENTRYP PFNDOLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); typedef void(APIENTRYP PFNDOLBLENDFUNCSEPARATEPROC)(GLenum sfactorRGB, GLenum dfactorRGB,
typedef void (APIENTRYP PFNDOLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount); GLenum sfactorAlpha, GLenum dfactorAlpha);
typedef void (APIENTRYP PFNDOLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount); typedef void(APIENTRYP PFNDOLMULTIDRAWARRAYSPROC)(GLenum mode, const GLint* first,
typedef void (APIENTRYP PFNDOLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param); const GLsizei* count, GLsizei drawcount);
typedef void (APIENTRYP PFNDOLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params); typedef void(APIENTRYP PFNDOLMULTIDRAWELEMENTSPROC)(GLenum mode, const GLsizei* count, GLenum type,
typedef void (APIENTRYP PFNDOLPOINTPARAMETERIPROC) (GLenum pname, GLint param); const void* const* indices, GLsizei drawcount);
typedef void (APIENTRYP PFNDOLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params); typedef void(APIENTRYP PFNDOLPOINTPARAMETERFPROC)(GLenum pname, GLfloat param);
typedef void (APIENTRYP PFNDOLFOGCOORDFPROC) (GLfloat coord); typedef void(APIENTRYP PFNDOLPOINTPARAMETERFVPROC)(GLenum pname, const GLfloat* params);
typedef void (APIENTRYP PFNDOLFOGCOORDFVPROC) (const GLfloat *coord); typedef void(APIENTRYP PFNDOLPOINTPARAMETERIPROC)(GLenum pname, GLint param);
typedef void (APIENTRYP PFNDOLFOGCOORDDPROC) (GLdouble coord); typedef void(APIENTRYP PFNDOLPOINTPARAMETERIVPROC)(GLenum pname, const GLint* params);
typedef void (APIENTRYP PFNDOLFOGCOORDDVPROC) (const GLdouble *coord); typedef void(APIENTRYP PFNDOLFOGCOORDFPROC)(GLfloat coord);
typedef void (APIENTRYP PFNDOLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const void *pointer); typedef void(APIENTRYP PFNDOLFOGCOORDFVPROC)(const GLfloat* coord);
typedef void (APIENTRYP PFNDOLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue); typedef void(APIENTRYP PFNDOLFOGCOORDDPROC)(GLdouble coord);
typedef void (APIENTRYP PFNDOLSECONDARYCOLOR3BVPROC) (const GLbyte *v); typedef void(APIENTRYP PFNDOLFOGCOORDDVPROC)(const GLdouble* coord);
typedef void (APIENTRYP PFNDOLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue); typedef void(APIENTRYP PFNDOLFOGCOORDPOINTERPROC)(GLenum type, GLsizei stride, const void* pointer);
typedef void (APIENTRYP PFNDOLSECONDARYCOLOR3DVPROC) (const GLdouble *v); typedef void(APIENTRYP PFNDOLSECONDARYCOLOR3BPROC)(GLbyte red, GLbyte green, GLbyte blue);
typedef void (APIENTRYP PFNDOLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue); typedef void(APIENTRYP PFNDOLSECONDARYCOLOR3BVPROC)(const GLbyte* v);
typedef void (APIENTRYP PFNDOLSECONDARYCOLOR3FVPROC) (const GLfloat *v); typedef void(APIENTRYP PFNDOLSECONDARYCOLOR3DPROC)(GLdouble red, GLdouble green, GLdouble blue);
typedef void (APIENTRYP PFNDOLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue); typedef void(APIENTRYP PFNDOLSECONDARYCOLOR3DVPROC)(const GLdouble* v);
typedef void (APIENTRYP PFNDOLSECONDARYCOLOR3IVPROC) (const GLint *v); typedef void(APIENTRYP PFNDOLSECONDARYCOLOR3FPROC)(GLfloat red, GLfloat green, GLfloat blue);
typedef void (APIENTRYP PFNDOLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue); typedef void(APIENTRYP PFNDOLSECONDARYCOLOR3FVPROC)(const GLfloat* v);
typedef void (APIENTRYP PFNDOLSECONDARYCOLOR3SVPROC) (const GLshort *v); typedef void(APIENTRYP PFNDOLSECONDARYCOLOR3IPROC)(GLint red, GLint green, GLint blue);
typedef void (APIENTRYP PFNDOLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue); typedef void(APIENTRYP PFNDOLSECONDARYCOLOR3IVPROC)(const GLint* v);
typedef void (APIENTRYP PFNDOLSECONDARYCOLOR3UBVPROC) (const GLubyte *v); typedef void(APIENTRYP PFNDOLSECONDARYCOLOR3SPROC)(GLshort red, GLshort green, GLshort blue);
typedef void (APIENTRYP PFNDOLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue); typedef void(APIENTRYP PFNDOLSECONDARYCOLOR3SVPROC)(const GLshort* v);
typedef void (APIENTRYP PFNDOLSECONDARYCOLOR3UIVPROC) (const GLuint *v); typedef void(APIENTRYP PFNDOLSECONDARYCOLOR3UBPROC)(GLubyte red, GLubyte green, GLubyte blue);
typedef void (APIENTRYP PFNDOLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue); typedef void(APIENTRYP PFNDOLSECONDARYCOLOR3UBVPROC)(const GLubyte* v);
typedef void (APIENTRYP PFNDOLSECONDARYCOLOR3USVPROC) (const GLushort *v); typedef void(APIENTRYP PFNDOLSECONDARYCOLOR3UIPROC)(GLuint red, GLuint green, GLuint blue);
typedef void (APIENTRYP PFNDOLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer); typedef void(APIENTRYP PFNDOLSECONDARYCOLOR3UIVPROC)(const GLuint* v);
typedef void (APIENTRYP PFNDOLWINDOWPOS2DPROC) (GLdouble x, GLdouble y); typedef void(APIENTRYP PFNDOLSECONDARYCOLOR3USPROC)(GLushort red, GLushort green, GLushort blue);
typedef void (APIENTRYP PFNDOLWINDOWPOS2DVPROC) (const GLdouble *v); typedef void(APIENTRYP PFNDOLSECONDARYCOLOR3USVPROC)(const GLushort* v);
typedef void (APIENTRYP PFNDOLWINDOWPOS2FPROC) (GLfloat x, GLfloat y); typedef void(APIENTRYP PFNDOLSECONDARYCOLORPOINTERPROC)(GLint size, GLenum type, GLsizei stride,
typedef void (APIENTRYP PFNDOLWINDOWPOS2FVPROC) (const GLfloat *v); const void* pointer);
typedef void (APIENTRYP PFNDOLWINDOWPOS2IPROC) (GLint x, GLint y); typedef void(APIENTRYP PFNDOLWINDOWPOS2DPROC)(GLdouble x, GLdouble y);
typedef void (APIENTRYP PFNDOLWINDOWPOS2IVPROC) (const GLint *v); typedef void(APIENTRYP PFNDOLWINDOWPOS2DVPROC)(const GLdouble* v);
typedef void (APIENTRYP PFNDOLWINDOWPOS2SPROC) (GLshort x, GLshort y); typedef void(APIENTRYP PFNDOLWINDOWPOS2FPROC)(GLfloat x, GLfloat y);
typedef void (APIENTRYP PFNDOLWINDOWPOS2SVPROC) (const GLshort *v); typedef void(APIENTRYP PFNDOLWINDOWPOS2FVPROC)(const GLfloat* v);
typedef void (APIENTRYP PFNDOLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z); typedef void(APIENTRYP PFNDOLWINDOWPOS2IPROC)(GLint x, GLint y);
typedef void (APIENTRYP PFNDOLWINDOWPOS3DVPROC) (const GLdouble *v); typedef void(APIENTRYP PFNDOLWINDOWPOS2IVPROC)(const GLint* v);
typedef void (APIENTRYP PFNDOLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z); typedef void(APIENTRYP PFNDOLWINDOWPOS2SPROC)(GLshort x, GLshort y);
typedef void (APIENTRYP PFNDOLWINDOWPOS3FVPROC) (const GLfloat *v); typedef void(APIENTRYP PFNDOLWINDOWPOS2SVPROC)(const GLshort* v);
typedef void (APIENTRYP PFNDOLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z); typedef void(APIENTRYP PFNDOLWINDOWPOS3DPROC)(GLdouble x, GLdouble y, GLdouble z);
typedef void (APIENTRYP PFNDOLWINDOWPOS3IVPROC) (const GLint *v); typedef void(APIENTRYP PFNDOLWINDOWPOS3DVPROC)(const GLdouble* v);
typedef void (APIENTRYP PFNDOLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z); typedef void(APIENTRYP PFNDOLWINDOWPOS3FPROC)(GLfloat x, GLfloat y, GLfloat z);
typedef void (APIENTRYP PFNDOLWINDOWPOS3SVPROC) (const GLshort *v); typedef void(APIENTRYP PFNDOLWINDOWPOS3FVPROC)(const GLfloat* v);
typedef void (APIENTRYP PFNDOLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); typedef void(APIENTRYP PFNDOLWINDOWPOS3IPROC)(GLint x, GLint y, GLint z);
typedef void (APIENTRYP PFNDOLBLENDEQUATIONPROC) (GLenum mode); typedef void(APIENTRYP PFNDOLWINDOWPOS3IVPROC)(const GLint* v);
typedef void(APIENTRYP PFNDOLWINDOWPOS3SPROC)(GLshort x, GLshort y, GLshort z);
typedef void(APIENTRYP PFNDOLWINDOWPOS3SVPROC)(const GLshort* v);
typedef void(APIENTRYP PFNDOLBLENDCOLORPROC)(GLfloat red, GLfloat green, GLfloat blue,
GLfloat alpha);
typedef void(APIENTRYP PFNDOLBLENDEQUATIONPROC)(GLenum mode);
// These two are provided by ARB_imaging as well // These two are provided by ARB_imaging as well
extern PFNDOLBLENDCOLORPROC dolBlendColor; extern PFNDOLBLENDCOLORPROC dolBlendColor;

View File

@ -74,25 +74,28 @@
#define GL_SRC0_ALPHA 0x8588 #define GL_SRC0_ALPHA 0x8588
#define GL_SRC2_ALPHA 0x858A #define GL_SRC2_ALPHA 0x858A
typedef void (APIENTRYP PFNDOLGENQUERIESPROC) (GLsizei n, GLuint *ids); typedef void(APIENTRYP PFNDOLGENQUERIESPROC)(GLsizei n, GLuint* ids);
typedef void (APIENTRYP PFNDOLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids); typedef void(APIENTRYP PFNDOLDELETEQUERIESPROC)(GLsizei n, const GLuint* ids);
typedef GLboolean (APIENTRYP PFNDOLISQUERYPROC) (GLuint id); typedef GLboolean(APIENTRYP PFNDOLISQUERYPROC)(GLuint id);
typedef void (APIENTRYP PFNDOLBEGINQUERYPROC) (GLenum target, GLuint id); typedef void(APIENTRYP PFNDOLBEGINQUERYPROC)(GLenum target, GLuint id);
typedef void (APIENTRYP PFNDOLENDQUERYPROC) (GLenum target); typedef void(APIENTRYP PFNDOLENDQUERYPROC)(GLenum target);
typedef void (APIENTRYP PFNDOLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params); typedef void(APIENTRYP PFNDOLGETQUERYIVPROC)(GLenum target, GLenum pname, GLint* params);
typedef void (APIENTRYP PFNDOLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params); typedef void(APIENTRYP PFNDOLGETQUERYOBJECTIVPROC)(GLuint id, GLenum pname, GLint* params);
typedef void (APIENTRYP PFNDOLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params); typedef void(APIENTRYP PFNDOLGETQUERYOBJECTUIVPROC)(GLuint id, GLenum pname, GLuint* params);
typedef void (APIENTRYP PFNDOLBINDBUFFERPROC) (GLenum target, GLuint buffer); typedef void(APIENTRYP PFNDOLBINDBUFFERPROC)(GLenum target, GLuint buffer);
typedef void (APIENTRYP PFNDOLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); typedef void(APIENTRYP PFNDOLDELETEBUFFERSPROC)(GLsizei n, const GLuint* buffers);
typedef void (APIENTRYP PFNDOLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); typedef void(APIENTRYP PFNDOLGENBUFFERSPROC)(GLsizei n, GLuint* buffers);
typedef GLboolean (APIENTRYP PFNDOLISBUFFERPROC) (GLuint buffer); typedef GLboolean(APIENTRYP PFNDOLISBUFFERPROC)(GLuint buffer);
typedef void (APIENTRYP PFNDOLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); typedef void(APIENTRYP PFNDOLBUFFERDATAPROC)(GLenum target, GLsizeiptr size, const void* data,
typedef void (APIENTRYP PFNDOLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); GLenum usage);
typedef void (APIENTRYP PFNDOLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, void *data); typedef void(APIENTRYP PFNDOLBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size,
typedef void *(APIENTRYP PFNDOLMAPBUFFERPROC) (GLenum target, GLenum access); const void* data);
typedef GLboolean (APIENTRYP PFNDOLUNMAPBUFFERPROC) (GLenum target); typedef void(APIENTRYP PFNDOLGETBUFFERSUBDATAPROC)(GLenum target, GLintptr offset, GLsizeiptr size,
typedef void (APIENTRYP PFNDOLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); void* data);
typedef void (APIENTRYP PFNDOLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void **params); typedef void*(APIENTRYP PFNDOLMAPBUFFERPROC)(GLenum target, GLenum access);
typedef GLboolean(APIENTRYP PFNDOLUNMAPBUFFERPROC)(GLenum target);
typedef void(APIENTRYP PFNDOLGETBUFFERPARAMETERIVPROC)(GLenum target, GLenum pname, GLint* params);
typedef void(APIENTRYP PFNDOLGETBUFFERPOINTERVPROC)(GLenum target, GLenum pname, void** params);
extern PFNDOLBEGINQUERYPROC dolBeginQuery; extern PFNDOLBEGINQUERYPROC dolBeginQuery;
extern PFNDOLBINDBUFFERPROC dolBindBuffer; extern PFNDOLBINDBUFFERPROC dolBindBuffer;

Some files were not shown because too many files have changed in this diff Show More