-
Notifications
You must be signed in to change notification settings - Fork 15
Events
RedDucks edited this page Nov 3, 2017
·
3 revisions
To fully utilize themes you will need to hook into the many events emitted (not all possible events are documented. All missing events were deemed useless to themes and thus have not been documented)
CemUI wraps themes into an iframe for quick, live switching. The iframe is given a custom window
property for the ipcRenderer, removing the step of requiring it in manually.
Sent from: ipcRenderer
let ipcRenderer = window.ipcRenderer; // Grab ipcRenderer from `window`
ipcRenderer.send('init');
Sent from: ipcRenderer
let ipcRenderer = window.ipcRenderer; // Grab ipcRenderer from `window`
ipcRenderer.send('open_dev');
Sent from: ipcRenderer
let ipcRenderer = window.ipcRenderer; // Grab ipcRenderer from `window`
// Things to do before theme is finished
ipcRenderer.send('theme_finished_loading');
Sent from: ipcRenderer
let ipcRenderer = window.ipcRenderer; // Grab ipcRenderer from `window`
document.querySelector('#open-menu-btn').onclick = () => {
ipcRenderer.send('open_menu');
}
Sent from: ipcRenderer
let ipcRenderer = window.ipcRenderer; // Grab ipcRenderer from `window`
document.querySelector('#update-check-btn').onclick = () => {
ipcRenderer.send('check_for_update');
}
Sent from: ipcRenderer
Type: String
let ipcRenderer = window.ipcRenderer; // Grab ipcRenderer from `window`
document.querySelector('#00050000-1010ED00').onclick = () => {
// 00050000-1010ED00 is the full qualified TID (title ID)
// for Mario Kart 8, EUR
ipcRenderer.send('play_rom', '00050000-1010ED00');
}
Sent from: ipcRenderer
Type: String
let ipcRenderer = window.ipcRenderer; // Grab ipcRenderer from `window`
document.querySelector('#00050000-1010ED00').onclick = () => {
// 00050000-1010ED00 is the full qualified TID (title ID)
// for Mario Kart 8, EUR
ipcRenderer.send('open_rom', '00050000-1010ED00');
}
Sent from: ipcRenderer
Type: Object
let ipcRenderer = window.ipcRenderer; // Grab ipcRenderer from `window`
document.querySelector('#00050000-1010ED00').onclick = () => {
// 00050000-1010ED00 is the full qualified TID (title ID)
// for Mario Kart 8, EUR
ipcRenderer.send('make_shortcut', {
emu: 'Default', // name of the Cemu instance. 'Default' is instance made during setup
rom: '00050000-1010ED00' // The fully qualified TID of the rom
});
}
Sent from: ipcRenderer
Type: String
let ipcRenderer = window.ipcRenderer; // Grab ipcRenderer from `window`
document.querySelector('#00050000-1010ED00').onclick = () => {
// 00050000-1010ED00 is the full qualified TID (title ID)
// for Mario Kart 8, EUR
ipcRenderer.send('set_favorite', '00050000-1010ED00');
}
Sent from: ipcRenderer
Type: String
let ipcRenderer = window.ipcRenderer; // Grab ipcRenderer from `window`
document.querySelector('#00050000-1010ED00').onclick = () => {
// 00050000-1010ED00 is the full qualified TID (title ID)
// for Mario Kart 8, EUR
ipcRenderer.send('remove_favorite', '00050000-1010ED00');
}
Sent from: ipcRenderer
Type: Object
let ipcRenderer = window.ipcRenderer; // Grab ipcRenderer from `window`
document.querySelector('#00050000-1010ED00').onclick = () => {
// 00050000-1010ED00 is the full qualified TID (title ID)
// for Mario Kart 8, EUR
ipcRenderer.send('make_shortcut', {
emu: 'Default', // name of the Cemu instance. 'Default' is instance made during setup
rom: '00050000-1010ED00', // The fully qualified TID of the rom
settings: {
// JSON-ified ini settings
}
});
}
Sent from: ipcRenderer
let ipcRenderer = window.ipcRenderer; // Grab ipcRenderer from `window`
ipcRenderer.send('ask_for_emulator_list');
Initialization complete. See Game Objects for information on game object structure
Sent from: ipcMain
Type: Object
let ipcRenderer = window.ipcRenderer; // Grab ipcRenderer from `window`
ipcRenderer.on('init_complete', (event, data) => {
console.log(data.library); // You game library. Array of Game Objects
console.log(data.suggested); // Suggested games. Array of Game Objects
console.log(data.most_played); // You game library organized by plays. Array of Game Objects
});
Generic controller event. CemUI uses See Controller.js for controller events. All controller events passed by CemUI are Controller.js events, but only the detail
property
Sent from: ipcMain
Type: Object
let ipcRenderer = window.ipcRenderer; // Grab ipcRenderer from `window`
ipcRenderer.on('controller_event', (event, data) => {
console.log('controller event');
});
A controller was found. CemUI uses See Controller.js for controller events. All controller events passed by CemUI are Controller.js events, but only the detail
property
Sent from: ipcMain
let ipcRenderer = window.ipcRenderer; // Grab ipcRenderer from `window`
ipcRenderer.on('controller_found', (event, data) => {
console.log('controller found, do something');
});
A button was pressed. CemUI uses See Controller.js for controller events. All controller events passed by CemUI are Controller.js events, but only the detail
property
Sent from: ipcMain
let ipcRenderer = window.ipcRenderer; // Grab ipcRenderer from `window`
ipcRenderer.on('controller_button_press', (event, data) => {
switch (data.name) {
case 'DPAD_UP': // ANALOG STICKS SEND DPAD EVENTS
// Move up?
break;
case 'DPAD_DOWN': // ANALOG STICKS SEND DPAD EVENTS
// Move down?
break;
case 'DPAD_LEFT': // ANALOG STICKS SEND DPAD EVENTS
// Move left?
break;
case 'DPAD_RIGHT': // ANALOG STICKS SEND DPAD EVENTS
// Move right?
break;
case 'START':
// Handle 'Start' button event
break;
case 'FACE_1': // A button XBox
// Handle button event
break;
case 'FACE_2': // B button XBox
// Handle button event
break;
}
});
Sends a list of all stored Cemu instances. See Cemu Instances for information on instance structure
Sent from: ipcMain
Type: Array
let ipcRenderer = window.ipcRenderer; // Grab ipcRenderer from `window`
ipcRenderer.on('emulator_list', (event, data) => {
// Do something like make dropdowns and such with the emulator list
});