Skip to content

Commit

Permalink
v1.0.0-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
wiredopposite committed Dec 8, 2024
1 parent 3eb0b56 commit ea69e60
Show file tree
Hide file tree
Showing 6 changed files with 962 additions and 0 deletions.
126 changes: 126 additions & 0 deletions WebApp/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
export const DEVICE_MODE_KEY_VALUE =
{
"Xbox OG" : 7,
"Xbox OG: Steel Battalion" : 8,
"Xbox OG: XRemote" : 9,
"XInput" : 6,
"PS3" : 2,
"PS Classic" : 5,
"Switch" : 4,
"WebApp" : 99,
};

export const PROFILE_ID_KEY_VALUE =
{
"Profile 1": 0x01,
"Profile 2": 0x02,
"Profile 3": 0x03,
"Profile 4": 0x04,
"Profile 5": 0x05,
"Profile 6": 0x06,
"Profile 7": 0x07,
"Profile 8": 0x08,
};

export const DPAD_KEY_VALUE =
{
"Up" : 0x01,
"Down" : 0x02,
"Left" : 0x04,
"Right" : 0x08,
};

export const BUTTON_KEY_VALUE =
{
"A" : 0x0001,
"B" : 0x0002,
"X" : 0x0004,
"Y" : 0x0008,
"L3" : 0x0010,
"R3" : 0x0020,
"Back" : 0x0040,
"Start" : 0x0080,
"LB" : 0x0100,
"RB" : 0x0200,
"Guide" : 0x0400,
"Misc" : 0x0800
};

export const ANALOG_KEY_VALUE =
{
"Up" : 0x00,
"Down" : 0x01,
"Left" : 0x02,
"Right" : 0x03,
"A" : 0x04,
"B" : 0x05,
"X" : 0x06,
"Y" : 0x07,
"LB" : 0x08,
"RB" : 0x09
};

export const PACKET_IDS =
{
INIT_READ : 0x88,
READ_PROFILE : 0x01,
WRITE_PROFILE : 0x02,
// WRITE_MODE : 0x03,
RESPONSE_OK : 0x10,
RESPONSE_ERROR : 0x11,
};

export function new_packet()
{
return {
report_id: 0,
input_mode: 0,
max_gamepads: 0,
player_idx: 0,

profile:
{
id: 0,

dz_trigger_l: 0,
dz_trigger_r: 0,

dz_joystick_l: 0,
dz_joystick_r: 0,

invert_ly: 0,
invert_ry: 0,

dpad_up: 0x01,
dpad_down: 0x02,
dpad_left: 0x04,
dpad_right: 0x08,

button_a: 0x0001,
button_b: 0x0002,
button_x: 0x0004,
button_y: 0x0008,
button_l3: 0x0010,
button_r3: 0x0020,
button_back: 0x0040,
button_start: 0x0080,
button_lb: 0x0100,
button_rb: 0x0200,
button_sys: 0x0400,
button_misc: 0x0800,

analog_enabled: 1,

analog_off_up: 0,
analog_off_down: 1,
analog_off_left: 2,
analog_off_right: 3,
analog_off_a: 4,
analog_off_b: 5,
analog_off_x: 6,
analog_off_y: 7,
analog_off_lb: 8,
analog_off_rb: 9
}
}
};
Binary file added WebApp/favicon.ico
Binary file not shown.
235 changes: 235 additions & 0 deletions WebApp/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>OGX-Mini Settings</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="container">
<h1>OGX-Mini Settings</h1>
<div class="connect-ui" id="connect-ui">
<button class="connect" id="connect">Connect</button><br><br>
<label>To ensure your adapter is in WebApp mode, hold Start + Left Bumper + Right Bumper for 3 seconds.</label>
<div class="error">
⚠️ This browser does not support the WebSerial API. Please try a different browser.
</div>
</div>
<div class="settings-ui" id="settings-ui">

<div class="settings">

<!-- <div>
<label>Firmware: <span id="firmwareVersion">v1.0.0</span></label>
</div> -->
<label>Minimum firmware required: v1.0.0</label>
<div>
<h3>Device Mode</h3>
</div>
<div class="setting-item">
<select id="device-mode"></select>
</div>

<div>
<h3>Current Profile</h3>
</div>
<div class="setting-item">
<select id="profile-id"></select>
</div>

<h3>Axis Settings</h3>
<div class="setting-item">
<label for="invert-joy-l">Invert Y Left</label>
<input type="checkbox" id="invert-joy-l">
<span id="invert-joy-l-value"></span>
</div>
<div class="setting-item">
<label for="invert-joy-r">Invert Y Right</label>
<input type="checkbox" id="invert-joy-r">
<span id="invert-joy-r-value"></span>
</div>

<div class="deadzone-settings">
<div class="setting-item">
<label for="deadzone-joy-l">Joystick Left Deadzone</label>
<input type="range" id="deadzone-joy-l" min="0" max="100">
<span id="deadzone-joy-l-value"></span>%
</div>
<div class="setting-item">
<label for="deadzone-joy-r">Joystick Right Deadzone</label>
<input type="range" id="deadzone-joy-r" min="0" max="100">
<span id="deadzone-joy-r-value"></span>%
</div>
<div class="setting-item">
<label for="deadzone-trigger-l">Trigger Left Deadzone</label>
<input type="range" id="deadzone-trigger-l" min="0" max="100">
<span id="deadzone-trigger-l-value"></span>%
</div>
<div class="setting-item">
<label for="deadzone-trigger-r">Trigger Right Deadzone</label>
<input type="range" id="deadzone-trigger-r" min="0" max="100">
<span id="deadzone-trigger-r-value"></span>%
</div>
</div>
<h3>Digital Mappings</h3>
<h4>D-Pad</h4>
<div class="button-map-settings">
<div class="button-pair">
<div class="button-item">
<label for="mapping-Up">Up:</label>
<select class="button-mapping" id="mapping-Up"></select>
</div>
<div class="button-item">
<label for="mapping-Down">Down:</label>
<select class="button-mapping" id="mapping-Down"></select>
</div>
</div>
<div class="button-pair">
<div class="button-item">
<label for="mapping-Left">Left:</label>
<select class="button-mapping" id="mapping-Left"></select>
</div>
<div class="button-item">
<label for="mapping-Right">Right:</label>
<select class="button-mapping" id="mapping-Right"></select>
</div>
</div>
</div>
<h4>Buttons</h4>
<div class="button-map-settings">
<div class="button-pair">
<div class="button-item">
<label for="mapping-A">A:</label>
<select class="button-mapping" id="mapping-A"></select>
</div>
<div class="button-item">
<label for="mapping-B">B:</label>
<select class="button-mapping" id="mapping-B"></select>
</div>
</div>
<div class="button-pair">
<div class="button-item">
<label for="mapping-X">X:</label>
<select class="button-mapping" id="mapping-X"></select>
</div>
<div class="button-item">
<label for="mapping-Y">Y:</label>
<select class="button-mapping" id="mapping-Y"></select>
</div>
</div>
<div class="button-pair">
<div class="button-item">
<label for="mapping-L3">L3:</label>
<select class="button-mapping" id="mapping-L3"></select>
</div>
<div class="button-item">
<label for="mapping-R3">R3:</label>
<select class="button-mapping" id="mapping-R3"></select>
</div>
</div>
<div class="button-pair">
<div class="button-item">
<label for="mapping-LB">LB:</label>
<select class="button-mapping" id="mapping-LB"></select>
</div>
<div class="button-item">
<label for="mapping-RB">RB:</label>
<select class="button-mapping" id="mapping-RB"></select>
</div>
</div>
<div class="button-pair">
<div class="button-item">
<label for="mapping-Start">Start/Plus/Options:</label>
<select class="button-mapping" id="mapping-Start"></select>
</div>
<div class="button-item">
<label for="mapping-Back">Back/Minus/Share:</label>
<select class="button-mapping" id="mapping-Back"></select>
</div>
</div>
<div class="button-pair">
<div class="button-item">
<label for="mapping-Guide">Guide/Home:</label>
<select class="button-mapping" id="mapping-Guide"></select>
</div>
<div class="button-item">
<label for="mapping-Misc">Misc/Capture/Mic:</label>
<select class="button-mapping" id="mapping-Misc"></select>
</div>
</div>
</div>

<h3>Analog Mappings</h3>
<div class="setting-item">
<label for="analog-enabled">Enable Analog Buttons</label>
<input type="checkbox" id="analog-enabled">
<span id="analog-enabled-value"></span>
</div>

<div class="button-map-settings">
<div class="button-pair">
<div class="button-item">
<label for="mapping-analog-Up">Up:</label>
<select class="button-mapping" id="mapping-analog-Up"></select>
</div>
<div class="button-item">
<label for="mapping-analog-Down">Down:</label>
<select class="button-mapping" id="mapping-analog-Down"></select>
</div>
</div>
<div class="button-pair">
<div class="button-item">
<label for="mapping-analog-Left">Left:</label>
<select class="button-mapping" id="mapping-analog-Left"></select>
</div>
<div class="button-item">
<label for="mapping-analog-Right">Right:</label>
<select class="button-mapping" id="mapping-analog-Right"></select>
</div>
</div>
<div class="button-pair">
<div class="button-item">
<label for="mapping-analog-A">A:</label>
<select class="button-mapping" id="mapping-analog-A"></select>
</div>
<div class="button-item">
<label for="mapping-analog-B">B:</label>
<select class="button-mapping" id="mapping-analog-B"></select>
</div>
</div>
<div class="button-pair">
<div class="button-item">
<label for="mapping-analog-X">X:</label>
<select class="button-mapping" id="mapping-analog-X"></select>
</div>
<div class="button-item">
<label for="mapping-analog-Y">Y:</label>
<select class="button-mapping" id="mapping-analog-Y"></select>
</div>
</div>
<div class="button-pair">
<div class="button-item">
<label for="mapping-analog-LB">LB:</label>
<select class="button-mapping" id="mapping-analog-LB"></select>
</div>
<div class="button-item">
<label for="mapping-analog-RB">RB:</label>
<select class="button-mapping" id="mapping-analog-RB"></select>
</div>
</div>
</div>

<label>Saving will reboot your OGX-Mini, the last saved profile will be active.</label><br><br>
<button class="settings-button" id="save">Save Profile</button>
<button class="settings-button" id="reload">Reload Profile</button>
<button class="settings-button" id="load-default">Load Defaults</button>
<button class="settings-button" id="disconnect">Disconnect</button>

</div>
</div>
</div>
<script type="module" src="index.js"></script>
</body>
</html>
Loading

0 comments on commit ea69e60

Please sign in to comment.