mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-02-23 22:52:34 +01:00
byuu says: Changelog: - added Cocoa target: higan can now be compiled for OS X Lion [Cydrak, byuu] - SNES/accuracy profile hires color blending improvements - fixes Marvelous text [AWJ] - fixed a slight bug in SNES/SA-1 VBR support caused by a typo - added support for multi-pass shaders that can load external textures (requires OpenGL 3.2+) - added game library path (used by ananke->Import Game) to Settings->Advanced - system profiles, shaders and cheats database can be stored in "all users" shared folders now (eg /usr/share on Linux) - all configuration files are in BML format now, instead of XML (much easier to read and edit this way) - main window supports drag-and-drop of game folders (but not game files / ZIP archives) - audio buffer clears when entering a modal loop on Windows (prevents audio repetition with DirectSound driver) - a substantial amount of code clean-up (probably the biggest refactoring to date) One highly desired target for this release was to default to the optimal drivers instead of the safest drivers, but because AMD drivers don't seem to like my OpenGL 3.2 driver, I've decided to postpone that. AMD has too big a market share. Hopefully with v093 officially released, we can get some public input on what AMD doesn't like.
104 lines
2.3 KiB
C++
104 lines
2.3 KiB
C++
#ifndef NALL_EMULATION_SUPER_FAMICOM_USART_HPP
|
|
#define NALL_EMULATION_SUPER_FAMICOM_USART_HPP
|
|
|
|
#include <nall/platform.hpp>
|
|
#include <nall/function.hpp>
|
|
#include <nall/serial.hpp>
|
|
#include <nall/stdint.hpp>
|
|
|
|
#include <signal.h>
|
|
#include <sys/time.h>
|
|
#include <sys/resource.h>
|
|
|
|
#define usartproc dllexport
|
|
|
|
static nall::function<bool ()> usart_quit;
|
|
static nall::function<void (unsigned milliseconds)> usart_usleep;
|
|
static nall::function<bool ()> usart_readable;
|
|
static nall::function<uint8_t ()> usart_read;
|
|
static nall::function<bool ()> usart_writable;
|
|
static nall::function<void (uint8_t data)> usart_write;
|
|
|
|
extern "C" usartproc void usart_init(
|
|
nall::function<bool ()> quit,
|
|
nall::function<void (unsigned milliseconds)> usleep,
|
|
nall::function<bool ()> readable,
|
|
nall::function<uint8_t ()> read,
|
|
nall::function<bool ()> writable,
|
|
nall::function<void (uint8_t data)> write
|
|
) {
|
|
usart_quit = quit;
|
|
usart_usleep = usleep;
|
|
usart_readable = readable;
|
|
usart_read = read;
|
|
usart_writable = writable;
|
|
usart_write = write;
|
|
}
|
|
|
|
extern "C" usartproc void usart_main(int, char**);
|
|
|
|
//
|
|
|
|
static nall::serial usart;
|
|
static bool usart_is_virtual = true;
|
|
static bool usart_sigint = false;
|
|
|
|
static bool usart_virtual() {
|
|
return usart_is_virtual;
|
|
}
|
|
|
|
//
|
|
|
|
static bool usarthw_quit() {
|
|
return usart_sigint;
|
|
}
|
|
|
|
static void usarthw_usleep(unsigned milliseconds) {
|
|
usleep(milliseconds);
|
|
}
|
|
|
|
static bool usarthw_readable() {
|
|
return usart.readable();
|
|
}
|
|
|
|
static uint8_t usarthw_read() {
|
|
while(true) {
|
|
uint8_t buffer[1];
|
|
signed length = usart.read((uint8_t*)&buffer, 1);
|
|
if(length > 0) return buffer[0];
|
|
}
|
|
}
|
|
|
|
static bool usarthw_writable() {
|
|
return usart.writable();
|
|
}
|
|
|
|
static void usarthw_write(uint8_t data) {
|
|
uint8_t buffer[1] = { data };
|
|
usart.write((uint8_t*)&buffer, 1);
|
|
}
|
|
|
|
static void sigint(int) {
|
|
signal(SIGINT, SIG_DFL);
|
|
usart_sigint = true;
|
|
}
|
|
|
|
int main(int argc, char** argv) {
|
|
setpriority(PRIO_PROCESS, 0, -20); //requires superuser privileges; otherwise priority = +0
|
|
signal(SIGINT, sigint);
|
|
|
|
if(usart.open("/dev/ttyACM0", 57600, true) == false) {
|
|
printf("error: unable to open USART hardware device\n");
|
|
return 0;
|
|
}
|
|
|
|
usart_is_virtual = false;
|
|
usart_init(usarthw_quit, usarthw_usleep, usarthw_readable, usarthw_read, usarthw_writable, usarthw_write);
|
|
usart_main(argc, argv);
|
|
usart.close();
|
|
|
|
return 0;
|
|
}
|
|
|
|
#endif
|