bsnes/sfc/system/video.cpp

168 lines
4.5 KiB
C++
Raw Normal View History

#ifdef SYSTEM_CPP
Video video;
void Video::generate_palette(Emulator::Interface::PaletteMode mode) {
Update to v088r03 release. byuu says: static vector<uint8_t> file::read(const string &filename); replaces: static bool file::read(const string &filename, uint8_t *&data, unsigned &size); This allows automatic deletion of the underlying data. Added vectorstream, which is obviously a vector<uint8_t> wrapper for a data stream. Plan is for all data accesses inside my emulation cores to take stream objects, especially MSU1. This lets you feed the core anything: memorystream, filestream, zipstream, gzipstream, httpstream, etc. There will still be exceptions for link and serial, those need actual library files on disk. But those aren't official hardware devices anyway. So to help with speed a bit, I'm rethinking the video rendering path. Previous system: - core outputs system-native samples (SNES = 19-bit LRGB, NES = 9-bit emphasis+palette, DMG = 2-bit grayscale, etc.) - interfaceSystem transforms samples to 30-bit via lookup table inside the emulation core - interfaceSystem masks off overscan areas, if enabled - interfaceUI runs filter to produce new target buffer, if enabled - interfaceUI transforms 30-bit video to native display depth (24-bit or 30-bit), and applies color-adjustments (gamma, etc) at the same time New system: - all cores now generate an internal palette, and call Interface::videoColor(uint32_t source, uint16_t red, uint16_t green, uint16_t blue) to get native display color post-adjusted (gamma, etc applied already.) - all cores output to uint32_t* buffer now (output video.palette[color] instead of just color) - interfaceUI runs filter to produce new target buffer, if enabled - interfaceUI memcpy()'s buffer to the video card videoColor() is pretty neat. source is the raw pixel (as per the old-format, 19-bit SNES, 9-bit NES, etc), and you can create a color from that if you really want to. Or return that value to get a buffer just like v088 and below. red, green, blue are 16-bits per channel, because why the hell not, right? Just lop off all the bits you don't want. If you have more bits on your display than that, fuck you :P The last step is extremely difficult to avoid. Video cards can and do have pitches that differ from the width of the texture. Trying to make the core account for this would be really awful. And even if we did that, the emulation routine would need to write directly to a video card RAM buffer. Some APIs require you to lock the video buffer while writing, so this would leave the video buffer locked for a long time. Probably not catastrophic, but still awful. And lastly, if the emulation core tried writing directly to the display texture, software filters would no longer be possible (unless you -really- jump through hooks and divert to a memory buffer when a filter is enabled, but ... fuck.) Anyway, the point of all that work was to eliminate an extra video copy, and the need for a really painful 30-bit to 24-bit conversion (three shifts, three masks, three array indexes.) So this basically reverts us, performance-wise, to where we were pre-30 bit support. [...] The downside to this is that we're going to need a filter for each output depth. Since the array type is uint32_t*, and I don't intend to support higher or lower depths, we really only need 24+30-bit versions of each filter. Kinda shitty, but oh well.
2012-04-27 12:12:53 +00:00
for(unsigned color = 0; color < (1 << 19); color++) {
if(mode == Emulator::Interface::PaletteMode::Literal) {
palette[color] = color;
continue;
}
Update to v088r03 release. byuu says: static vector<uint8_t> file::read(const string &filename); replaces: static bool file::read(const string &filename, uint8_t *&data, unsigned &size); This allows automatic deletion of the underlying data. Added vectorstream, which is obviously a vector<uint8_t> wrapper for a data stream. Plan is for all data accesses inside my emulation cores to take stream objects, especially MSU1. This lets you feed the core anything: memorystream, filestream, zipstream, gzipstream, httpstream, etc. There will still be exceptions for link and serial, those need actual library files on disk. But those aren't official hardware devices anyway. So to help with speed a bit, I'm rethinking the video rendering path. Previous system: - core outputs system-native samples (SNES = 19-bit LRGB, NES = 9-bit emphasis+palette, DMG = 2-bit grayscale, etc.) - interfaceSystem transforms samples to 30-bit via lookup table inside the emulation core - interfaceSystem masks off overscan areas, if enabled - interfaceUI runs filter to produce new target buffer, if enabled - interfaceUI transforms 30-bit video to native display depth (24-bit or 30-bit), and applies color-adjustments (gamma, etc) at the same time New system: - all cores now generate an internal palette, and call Interface::videoColor(uint32_t source, uint16_t red, uint16_t green, uint16_t blue) to get native display color post-adjusted (gamma, etc applied already.) - all cores output to uint32_t* buffer now (output video.palette[color] instead of just color) - interfaceUI runs filter to produce new target buffer, if enabled - interfaceUI memcpy()'s buffer to the video card videoColor() is pretty neat. source is the raw pixel (as per the old-format, 19-bit SNES, 9-bit NES, etc), and you can create a color from that if you really want to. Or return that value to get a buffer just like v088 and below. red, green, blue are 16-bits per channel, because why the hell not, right? Just lop off all the bits you don't want. If you have more bits on your display than that, fuck you :P The last step is extremely difficult to avoid. Video cards can and do have pitches that differ from the width of the texture. Trying to make the core account for this would be really awful. And even if we did that, the emulation routine would need to write directly to a video card RAM buffer. Some APIs require you to lock the video buffer while writing, so this would leave the video buffer locked for a long time. Probably not catastrophic, but still awful. And lastly, if the emulation core tried writing directly to the display texture, software filters would no longer be possible (unless you -really- jump through hooks and divert to a memory buffer when a filter is enabled, but ... fuck.) Anyway, the point of all that work was to eliminate an extra video copy, and the need for a really painful 30-bit to 24-bit conversion (three shifts, three masks, three array indexes.) So this basically reverts us, performance-wise, to where we were pre-30 bit support. [...] The downside to this is that we're going to need a filter for each output depth. Since the array type is uint32_t*, and I don't intend to support higher or lower depths, we really only need 24+30-bit versions of each filter. Kinda shitty, but oh well.
2012-04-27 12:12:53 +00:00
unsigned l = (color >> 15) & 15;
unsigned b = (color >> 10) & 31;
unsigned g = (color >> 5) & 31;
unsigned r = (color >> 0) & 31;
if(mode == Emulator::Interface::PaletteMode::Channel) {
l = image::normalize(l, 4, 16);
r = image::normalize(r, 5, 16);
g = image::normalize(g, 5, 16);
b = image::normalize(b, 5, 16);
palette[color] = interface->videoColor(color, l, r, g, b);
continue;
}
if(mode == Emulator::Interface::PaletteMode::Emulation) {
r = gamma_ramp[r];
g = gamma_ramp[g];
b = gamma_ramp[b];
} else {
r = image::normalize(r, 5, 8);
g = image::normalize(g, 5, 8);
b = image::normalize(b, 5, 8);
}
Update to v088r03 release. byuu says: static vector<uint8_t> file::read(const string &filename); replaces: static bool file::read(const string &filename, uint8_t *&data, unsigned &size); This allows automatic deletion of the underlying data. Added vectorstream, which is obviously a vector<uint8_t> wrapper for a data stream. Plan is for all data accesses inside my emulation cores to take stream objects, especially MSU1. This lets you feed the core anything: memorystream, filestream, zipstream, gzipstream, httpstream, etc. There will still be exceptions for link and serial, those need actual library files on disk. But those aren't official hardware devices anyway. So to help with speed a bit, I'm rethinking the video rendering path. Previous system: - core outputs system-native samples (SNES = 19-bit LRGB, NES = 9-bit emphasis+palette, DMG = 2-bit grayscale, etc.) - interfaceSystem transforms samples to 30-bit via lookup table inside the emulation core - interfaceSystem masks off overscan areas, if enabled - interfaceUI runs filter to produce new target buffer, if enabled - interfaceUI transforms 30-bit video to native display depth (24-bit or 30-bit), and applies color-adjustments (gamma, etc) at the same time New system: - all cores now generate an internal palette, and call Interface::videoColor(uint32_t source, uint16_t red, uint16_t green, uint16_t blue) to get native display color post-adjusted (gamma, etc applied already.) - all cores output to uint32_t* buffer now (output video.palette[color] instead of just color) - interfaceUI runs filter to produce new target buffer, if enabled - interfaceUI memcpy()'s buffer to the video card videoColor() is pretty neat. source is the raw pixel (as per the old-format, 19-bit SNES, 9-bit NES, etc), and you can create a color from that if you really want to. Or return that value to get a buffer just like v088 and below. red, green, blue are 16-bits per channel, because why the hell not, right? Just lop off all the bits you don't want. If you have more bits on your display than that, fuck you :P The last step is extremely difficult to avoid. Video cards can and do have pitches that differ from the width of the texture. Trying to make the core account for this would be really awful. And even if we did that, the emulation routine would need to write directly to a video card RAM buffer. Some APIs require you to lock the video buffer while writing, so this would leave the video buffer locked for a long time. Probably not catastrophic, but still awful. And lastly, if the emulation core tried writing directly to the display texture, software filters would no longer be possible (unless you -really- jump through hooks and divert to a memory buffer when a filter is enabled, but ... fuck.) Anyway, the point of all that work was to eliminate an extra video copy, and the need for a really painful 30-bit to 24-bit conversion (three shifts, three masks, three array indexes.) So this basically reverts us, performance-wise, to where we were pre-30 bit support. [...] The downside to this is that we're going to need a filter for each output depth. Since the array type is uint32_t*, and I don't intend to support higher or lower depths, we really only need 24+30-bit versions of each filter. Kinda shitty, but oh well.
2012-04-27 12:12:53 +00:00
double L = (1.0 + l) / 16.0;
if(l == 0) L *= 0.5;
unsigned R = L * image::normalize(r, 8, 16);
unsigned G = L * image::normalize(g, 8, 16);
unsigned B = L * image::normalize(b, 8, 16);
Update to v088r03 release. byuu says: static vector<uint8_t> file::read(const string &filename); replaces: static bool file::read(const string &filename, uint8_t *&data, unsigned &size); This allows automatic deletion of the underlying data. Added vectorstream, which is obviously a vector<uint8_t> wrapper for a data stream. Plan is for all data accesses inside my emulation cores to take stream objects, especially MSU1. This lets you feed the core anything: memorystream, filestream, zipstream, gzipstream, httpstream, etc. There will still be exceptions for link and serial, those need actual library files on disk. But those aren't official hardware devices anyway. So to help with speed a bit, I'm rethinking the video rendering path. Previous system: - core outputs system-native samples (SNES = 19-bit LRGB, NES = 9-bit emphasis+palette, DMG = 2-bit grayscale, etc.) - interfaceSystem transforms samples to 30-bit via lookup table inside the emulation core - interfaceSystem masks off overscan areas, if enabled - interfaceUI runs filter to produce new target buffer, if enabled - interfaceUI transforms 30-bit video to native display depth (24-bit or 30-bit), and applies color-adjustments (gamma, etc) at the same time New system: - all cores now generate an internal palette, and call Interface::videoColor(uint32_t source, uint16_t red, uint16_t green, uint16_t blue) to get native display color post-adjusted (gamma, etc applied already.) - all cores output to uint32_t* buffer now (output video.palette[color] instead of just color) - interfaceUI runs filter to produce new target buffer, if enabled - interfaceUI memcpy()'s buffer to the video card videoColor() is pretty neat. source is the raw pixel (as per the old-format, 19-bit SNES, 9-bit NES, etc), and you can create a color from that if you really want to. Or return that value to get a buffer just like v088 and below. red, green, blue are 16-bits per channel, because why the hell not, right? Just lop off all the bits you don't want. If you have more bits on your display than that, fuck you :P The last step is extremely difficult to avoid. Video cards can and do have pitches that differ from the width of the texture. Trying to make the core account for this would be really awful. And even if we did that, the emulation routine would need to write directly to a video card RAM buffer. Some APIs require you to lock the video buffer while writing, so this would leave the video buffer locked for a long time. Probably not catastrophic, but still awful. And lastly, if the emulation core tried writing directly to the display texture, software filters would no longer be possible (unless you -really- jump through hooks and divert to a memory buffer when a filter is enabled, but ... fuck.) Anyway, the point of all that work was to eliminate an extra video copy, and the need for a really painful 30-bit to 24-bit conversion (three shifts, three masks, three array indexes.) So this basically reverts us, performance-wise, to where we were pre-30 bit support. [...] The downside to this is that we're going to need a filter for each output depth. Since the array type is uint32_t*, and I don't intend to support higher or lower depths, we really only need 24+30-bit versions of each filter. Kinda shitty, but oh well.
2012-04-27 12:12:53 +00:00
palette[color] = interface->videoColor(color, 0, R, G, B);
}
}
Video::Video() {
palette = new uint32_t[1 << 19]();
}
Video::~Video() {
delete[] palette;
}
//internal
const uint8_t Video::gamma_ramp[32] = {
0x00, 0x01, 0x03, 0x06, 0x0a, 0x0f, 0x15, 0x1c,
0x24, 0x2d, 0x37, 0x42, 0x4e, 0x5b, 0x69, 0x78,
0x88, 0x90, 0x98, 0xa0, 0xa8, 0xb0, 0xb8, 0xc0,
0xc8, 0xd0, 0xd8, 0xe0, 0xe8, 0xf0, 0xf8, 0xff,
};
const uint8_t Video::cursor[15 * 15] = {
0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,
0,0,0,0,1,1,2,2,2,1,1,0,0,0,0,
0,0,0,1,2,2,1,2,1,2,2,1,0,0,0,
0,0,1,2,1,1,0,1,0,1,1,2,1,0,0,
0,1,2,1,0,0,0,1,0,0,0,1,2,1,0,
0,1,2,1,0,0,1,2,1,0,0,1,2,1,0,
1,2,1,0,0,1,1,2,1,1,0,0,1,2,1,
1,2,2,1,1,2,2,2,2,2,1,1,2,2,1,
1,2,1,0,0,1,1,2,1,1,0,0,1,2,1,
0,1,2,1,0,0,1,2,1,0,0,1,2,1,0,
0,1,2,1,0,0,0,1,0,0,0,1,2,1,0,
0,0,1,2,1,1,0,1,0,1,1,2,1,0,0,
0,0,0,1,2,2,1,2,1,2,2,1,0,0,0,
0,0,0,0,1,1,2,2,2,1,1,0,0,0,0,
0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,
};
void Video::draw_cursor(uint16_t color, int x, int y) {
uint32_t* data = (uint32_t*)ppu.output;
if(ppu.interlace() && ppu.field()) data += 512;
for(int cy = 0; cy < 15; cy++) {
int vy = y + cy - 7;
if(vy <= 0 || vy >= 240) continue; //do not draw offscreen
bool hires = (line_width[vy] == 512);
for(int cx = 0; cx < 15; cx++) {
int vx = x + cx - 7;
if(vx < 0 || vx >= 256) continue; //do not draw offscreen
uint8_t pixel = cursor[cy * 15 + cx];
if(pixel == 0) continue;
uint32_t pixelcolor = (15 << 15) | ((pixel == 1) ? 0 : color);
if(hires == false) {
Update to v094r08 release. byuu says: Lots of changes this time around. FreeBSD stability and compilation is still a work in progress. FreeBSD 10 + Clang 3.3 = 108fps FreeBSD 10 + GCC 4.7 = 130fps Errata 1: I've been fighting that god-damned endian.h header for the past nine WIPs now. The above WIP isn't building now because FreeBSD isn't including headers before using certain types, and you end up with a trillion error messages. So just delete all the endian.h includes from nall/intrinsics.hpp to build. Errata 2: I was trying to match g++ and g++47, so I used $(findstring g++,$(compiler)), which ends up also matching clang++. Oops. Easy fix, put Clang first and then else if g++ next. Not ideal, but oh well. All it's doing for now is declaring -fwrapv twice, so you don't have to fix it just yet. Probably just going to alias g++="g++47" and do exact matching instead. Errata 3: both OpenGL::term and VideoGLX::term are causing a core dump on BSD. No idea why. The resources are initialized and valid, but releasing them crashes the application. Changelog: - nall/Makefile is more flexible with overriding $(compiler), so you can build with GCC or Clang on BSD (defaults to GCC now) - PLATFORM_X was renamed to PLATFORM_XORG, and it's also declared with PLATFORM_LINUX or PLATFORM_BSD - PLATFORM_XORG probably isn't the best name ... still thinking about what best to call LINUX|BSD|SOLARIS or ^(WINDOWS|MACOSX) - fixed a few legitimate Clang warning messages in nall - Compiler::VisualCPP is ugly as hell, renamed to Compiler::CL - nall/platform includes nall/intrinsics first. Trying to move away from testing for _WIN32, etc directly in all files. Work in progress. - nall turns off Clang warnings that I won't "fix", because they aren't broken. It's much less noisy to compile with warnings on now. - phoenix gains the ability to set background and foreground colors on various text container widgets (GTK only for now.) - rewrote a lot of the MSU1 code to try and simplify it. Really hope I didn't break anything ... I don't have any MSU1 test ROMs handy - SNES coprocessor audio is now mixed as sclamp<16>(system_sample + coprocessor_sample) instead of sclamp<16>((sys + cop) / 2) - allows for greater chance of aliasing (still low, SNES audio is quiet), but doesn't cut base system volume in half anymore - fixed Super Scope and Justifier cursor colors - use input.xlib instead of input.x ... allows Xlib input driver to be visible on Linux and BSD once again - make install and make uninstall must be run as root again; no longer using install but cp instead for BSD compatibility - killed $(DESTDIR) ... use make prefix=$DESTDIR$prefix instead - you can now set text/background colors for the loki console via (eg): - settings.terminal.background-color 0x000000 - settings.terminal.foreground-color 0xffffff
2014-02-24 09:39:09 +00:00
*((uint32_t*)data + vy * 1024 + vx) = pixelcolor;
} else {
Update to v094r08 release. byuu says: Lots of changes this time around. FreeBSD stability and compilation is still a work in progress. FreeBSD 10 + Clang 3.3 = 108fps FreeBSD 10 + GCC 4.7 = 130fps Errata 1: I've been fighting that god-damned endian.h header for the past nine WIPs now. The above WIP isn't building now because FreeBSD isn't including headers before using certain types, and you end up with a trillion error messages. So just delete all the endian.h includes from nall/intrinsics.hpp to build. Errata 2: I was trying to match g++ and g++47, so I used $(findstring g++,$(compiler)), which ends up also matching clang++. Oops. Easy fix, put Clang first and then else if g++ next. Not ideal, but oh well. All it's doing for now is declaring -fwrapv twice, so you don't have to fix it just yet. Probably just going to alias g++="g++47" and do exact matching instead. Errata 3: both OpenGL::term and VideoGLX::term are causing a core dump on BSD. No idea why. The resources are initialized and valid, but releasing them crashes the application. Changelog: - nall/Makefile is more flexible with overriding $(compiler), so you can build with GCC or Clang on BSD (defaults to GCC now) - PLATFORM_X was renamed to PLATFORM_XORG, and it's also declared with PLATFORM_LINUX or PLATFORM_BSD - PLATFORM_XORG probably isn't the best name ... still thinking about what best to call LINUX|BSD|SOLARIS or ^(WINDOWS|MACOSX) - fixed a few legitimate Clang warning messages in nall - Compiler::VisualCPP is ugly as hell, renamed to Compiler::CL - nall/platform includes nall/intrinsics first. Trying to move away from testing for _WIN32, etc directly in all files. Work in progress. - nall turns off Clang warnings that I won't "fix", because they aren't broken. It's much less noisy to compile with warnings on now. - phoenix gains the ability to set background and foreground colors on various text container widgets (GTK only for now.) - rewrote a lot of the MSU1 code to try and simplify it. Really hope I didn't break anything ... I don't have any MSU1 test ROMs handy - SNES coprocessor audio is now mixed as sclamp<16>(system_sample + coprocessor_sample) instead of sclamp<16>((sys + cop) / 2) - allows for greater chance of aliasing (still low, SNES audio is quiet), but doesn't cut base system volume in half anymore - fixed Super Scope and Justifier cursor colors - use input.xlib instead of input.x ... allows Xlib input driver to be visible on Linux and BSD once again - make install and make uninstall must be run as root again; no longer using install but cp instead for BSD compatibility - killed $(DESTDIR) ... use make prefix=$DESTDIR$prefix instead - you can now set text/background colors for the loki console via (eg): - settings.terminal.background-color 0x000000 - settings.terminal.foreground-color 0xffffff
2014-02-24 09:39:09 +00:00
*((uint32_t*)data + vy * 1024 + vx * 2 + 0) = pixelcolor;
*((uint32_t*)data + vy * 1024 + vx * 2 + 1) = pixelcolor;
}
}
}
}
void Video::update() {
switch(configuration.controller_port2) {
case Input::Device::SuperScope:
if(dynamic_cast<SuperScope*>(input.port2)) {
SuperScope &device = (SuperScope&)*input.port2;
draw_cursor(0x7c00, device.x, device.y);
}
break;
case Input::Device::Justifier:
case Input::Device::Justifiers:
if(dynamic_cast<Justifier*>(input.port2)) {
Justifier &device = (Justifier&)*input.port2;
draw_cursor(0x001f, device.player1.x, device.player1.y);
if(device.chained == false) break;
draw_cursor(0x02e0, device.player2.x, device.player2.y);
}
break;
}
uint32_t* data = (uint32_t*)ppu.output;
if(ppu.interlace() && ppu.field()) data += 512;
Update to v078 release. byuu says: Finally, a new release. I have been very busy finishing up SNES box, cartridge and PCB scanning plus cataloguing the data, however this release still has some significant improvements. Most notably would be randomization on startup. This will help match the behavior of real hardware and uninitialized memory + registers. It should help catch homebrew software that forgets to initialize things properly. Of course, I was not able to test the complete library, so it is possible that if I've randomized anything that should be constant, that this could cause a regression. You can disable this randomization for netplay or to work around any incompatibilities by editing bsnes.cfg and setting snes.random to false. The GUI also received some updates. Widget sizes are now computed based on font sizes, giving it a perfectly native look (because it is native.) I've also added a hotkey remapping screen to the input settings. Not only can you remap inputs to controllers now, but those who did not know the hotkey bindings can now quickly see which ones exist and what they are mapped to. Changelog (since v077): - memory and most registers are now randomly initialized on power-up - fixed auto joypad polling issue in Super Star Wars - fixed .nec and .rtc file extensions (they were missing the dot) [krom] - PPU/accuracy now clears overscan region on any frame when it is disabled - PPU/compatibility no longer auto-blends hires pixels (use NTSC filter for this) - added hotkey remapping dialog to input settings window - added a few new hotkeys, including quick-reset - phoenix API now auto-sizes widgets based on font sizes - file dialog once again remembers previously selected file when possible
2011-04-30 13:12:15 +00:00
if(hires) {
//normalize line widths
for(unsigned y = 0; y < 240; y++) {
if(line_width[y] == 512) continue;
Update to v083 release. byuu says: This release adds preliminary Nintendo / Famicom emulation. It's only a week or two old, so a lot of work still needs to be done before it can compete with the most popular NES emulators. It's important to clarify: bsnes is primarily an SNES emulator. That will always be its forte and my core focus. I have added Game Boy support previously for Super Game Boy emulation, and I've added NES support mostly for something fun to work on to break up the monotony of working on one system for seven years now. Obviously, I'd like the emulation to be accurate and highly compatible, but I simply cannot afford to invest the same amount of time and money into any other systems. Still, either way the NES and GB emulation serve as fun side-diversions, and allow for a unified emulator interface with all of bsnes' unique features applied to all systems. My personal favorite feature is mightymo's extended built-in cheat code database that now also includes NES and Game Boy codes. And it even works in Super Game Boy mode now, too! I'm also not worried about speed at all: so long as NES/GB are faster than SNES/compatibility, it's fine by me. Note that due to the NES audio running at 1.78MHz, and Game Boy audio at 4MHz stereo, a more sophisticated audio resampler was needed: Ryphecha (Mednafen author) has graciously written a first-rate resampler: it is a band-limited Kaiser-windowed polyphase sinc resampler. It is combined with two highpass filters to remove DC bias. The filter itself is SSE optimized, but even still, approximately 50% of CPU usage for NES/GB emulation goes to the audio filtering alone. However, you now have the best sound possible for NES and Game Boy emulation as a result. The GUI has also been heavily re-structured to accommodate multiple emulators from the same interface. As such, it's quite likely a few bugs are still lurking here and there. Please report them and I'll iron them out for the next release. Changelog: - license is now GPLv3 - re-structured GUI as a multi-system emulator - added NES emulation [byuu, Ryphecha] - added NES ICs: MMC1, MMC2, MMC3, MMC4, MMC5, VRC4, VRC6+audio, VRC7, Sunsoft-5B+audio, Bandai-LZ93D50 - added NES boards: AxROM, BNROM, CNROM, ExROM, FxROM, GxROM, NROM, PxROM, SxROM, TxROM, UxROM - Game Boy emulation improvements [Jonas Quinn] - SNES core outputs full 19-bit color (4-bit luma included) for more accurate color reproduction (~5% speed hit) - audio resampler is now a band-limited polyphase resampler [Ryphecha] - cheat database includes NES+GB codes as well [mightymo, tukuyomi] - lots of other changes
2011-10-14 10:05:25 +00:00
uint32_t *buffer = data + y * 1024;
for(signed x = 255; x >= 0; x--) {
buffer[(x * 2) + 0] = buffer[(x * 2) + 1] = buffer[x];
}
}
}
Update to v088r15 release. byuu says: Changelog: - default placement of presentation window optimized for 1024x768 displays or larger (sorry if yours is smaller, move the window yourself.) - Direct3D waits until a previous Vblank ends before waiting for the next Vblank to begin (fixes video timing analysis, and ---really--- fast computers.) - Window::setVisible(false) clears modality, but also fixed in Browser code as well (fixes loading images on Windows hanging) - Browser won't consume full CPU resources (but timing analysis will, I don't want stalls to affect the results.) - closing settings window while analyzing stops analysis - you can load the SGB BIOS without a game (why the hell you would want to ...) - escape closes the Browser window (it won't close other dialogs, it has to be hooked up per-window) - just for fun, joypad hat up/down moves in Browser file list, any joypad button loads selected game [not very useful, lacks repeat, and there aren't GUI load file open buttons] - Super Scope and Justifier crosshairs render correctly (probably doesn't belong in the core, but it's not something I suspect people want to do themselves ...) - you can load GB, SGB, GB, SGB ... without problems (not happy with how I did this, but I don't want to add an Interface::setInterface() function yet) - PAL timing works as I want now (if you want 50fps on a 60hz monitor, you must not use sync video) [needed to update the DSP frequency when toggling video/audio sync] - not going to save input port selection for now (lot of work), but it will properly keep your port setting across cartridge loads at least [just goes to controller on emulator restart] - SFC overscan on and off both work as expected now (off centers image, on shows entire image) - laevateinn compiles properly now - ethos goes to ~/.config/bsnes now that target-ui is dead [honestly, I recommend deleting the old folder and starting over] - Emulator::Interface callbacks converted to virtual binding structure that GUI inherits from (simplifies binding callbacks) - this breaks Super Game Boy for a bit, I need to rethink system-specific bindings without direct inheritance Timing analysis works spectacularly well on Windows, too. You won't get your 100% perfect rate (unless maybe you leave the analysis running overnight?), but it'll get really freaking close this way.
2012-05-07 23:29:03 +00:00
//overscan: when disabled, shift image down (by scrolling video buffer up) to center image onscreen
//(memory before ppu.output is filled with black scanlines)
interface->videoRefresh(
video.palette,
Update to v088r15 release. byuu says: Changelog: - default placement of presentation window optimized for 1024x768 displays or larger (sorry if yours is smaller, move the window yourself.) - Direct3D waits until a previous Vblank ends before waiting for the next Vblank to begin (fixes video timing analysis, and ---really--- fast computers.) - Window::setVisible(false) clears modality, but also fixed in Browser code as well (fixes loading images on Windows hanging) - Browser won't consume full CPU resources (but timing analysis will, I don't want stalls to affect the results.) - closing settings window while analyzing stops analysis - you can load the SGB BIOS without a game (why the hell you would want to ...) - escape closes the Browser window (it won't close other dialogs, it has to be hooked up per-window) - just for fun, joypad hat up/down moves in Browser file list, any joypad button loads selected game [not very useful, lacks repeat, and there aren't GUI load file open buttons] - Super Scope and Justifier crosshairs render correctly (probably doesn't belong in the core, but it's not something I suspect people want to do themselves ...) - you can load GB, SGB, GB, SGB ... without problems (not happy with how I did this, but I don't want to add an Interface::setInterface() function yet) - PAL timing works as I want now (if you want 50fps on a 60hz monitor, you must not use sync video) [needed to update the DSP frequency when toggling video/audio sync] - not going to save input port selection for now (lot of work), but it will properly keep your port setting across cartridge loads at least [just goes to controller on emulator restart] - SFC overscan on and off both work as expected now (off centers image, on shows entire image) - laevateinn compiles properly now - ethos goes to ~/.config/bsnes now that target-ui is dead [honestly, I recommend deleting the old folder and starting over] - Emulator::Interface callbacks converted to virtual binding structure that GUI inherits from (simplifies binding callbacks) - this breaks Super Game Boy for a bit, I need to rethink system-specific bindings without direct inheritance Timing analysis works spectacularly well on Windows, too. You won't get your 100% perfect rate (unless maybe you leave the analysis running overnight?), but it'll get really freaking close this way.
2012-05-07 23:29:03 +00:00
ppu.output - (ppu.overscan() ? 0 : 7 * 1024),
4 * (1024 >> ppu.interlace()),
256 << hires,
240 << ppu.interlace()
);
Update to v078 release. byuu says: Finally, a new release. I have been very busy finishing up SNES box, cartridge and PCB scanning plus cataloguing the data, however this release still has some significant improvements. Most notably would be randomization on startup. This will help match the behavior of real hardware and uninitialized memory + registers. It should help catch homebrew software that forgets to initialize things properly. Of course, I was not able to test the complete library, so it is possible that if I've randomized anything that should be constant, that this could cause a regression. You can disable this randomization for netplay or to work around any incompatibilities by editing bsnes.cfg and setting snes.random to false. The GUI also received some updates. Widget sizes are now computed based on font sizes, giving it a perfectly native look (because it is native.) I've also added a hotkey remapping screen to the input settings. Not only can you remap inputs to controllers now, but those who did not know the hotkey bindings can now quickly see which ones exist and what they are mapped to. Changelog (since v077): - memory and most registers are now randomly initialized on power-up - fixed auto joypad polling issue in Super Star Wars - fixed .nec and .rtc file extensions (they were missing the dot) [krom] - PPU/accuracy now clears overscan region on any frame when it is disabled - PPU/compatibility no longer auto-blends hires pixels (use NTSC filter for this) - added hotkey remapping dialog to input settings window - added a few new hotkeys, including quick-reset - phoenix API now auto-sizes widgets based on font sizes - file dialog once again remembers previously selected file when possible
2011-04-30 13:12:15 +00:00
hires = false;
}
void Video::scanline() {
unsigned y = cpu.vcounter();
if(y >= 240) return;
Update to v078 release. byuu says: Finally, a new release. I have been very busy finishing up SNES box, cartridge and PCB scanning plus cataloguing the data, however this release still has some significant improvements. Most notably would be randomization on startup. This will help match the behavior of real hardware and uninitialized memory + registers. It should help catch homebrew software that forgets to initialize things properly. Of course, I was not able to test the complete library, so it is possible that if I've randomized anything that should be constant, that this could cause a regression. You can disable this randomization for netplay or to work around any incompatibilities by editing bsnes.cfg and setting snes.random to false. The GUI also received some updates. Widget sizes are now computed based on font sizes, giving it a perfectly native look (because it is native.) I've also added a hotkey remapping screen to the input settings. Not only can you remap inputs to controllers now, but those who did not know the hotkey bindings can now quickly see which ones exist and what they are mapped to. Changelog (since v077): - memory and most registers are now randomly initialized on power-up - fixed auto joypad polling issue in Super Star Wars - fixed .nec and .rtc file extensions (they were missing the dot) [krom] - PPU/accuracy now clears overscan region on any frame when it is disabled - PPU/compatibility no longer auto-blends hires pixels (use NTSC filter for this) - added hotkey remapping dialog to input settings window - added a few new hotkeys, including quick-reset - phoenix API now auto-sizes widgets based on font sizes - file dialog once again remembers previously selected file when possible
2011-04-30 13:12:15 +00:00
hires |= ppu.hires();
unsigned width = (ppu.hires() == false ? 256 : 512);
line_width[y] = width;
}
void Video::init() {
Update to v078 release. byuu says: Finally, a new release. I have been very busy finishing up SNES box, cartridge and PCB scanning plus cataloguing the data, however this release still has some significant improvements. Most notably would be randomization on startup. This will help match the behavior of real hardware and uninitialized memory + registers. It should help catch homebrew software that forgets to initialize things properly. Of course, I was not able to test the complete library, so it is possible that if I've randomized anything that should be constant, that this could cause a regression. You can disable this randomization for netplay or to work around any incompatibilities by editing bsnes.cfg and setting snes.random to false. The GUI also received some updates. Widget sizes are now computed based on font sizes, giving it a perfectly native look (because it is native.) I've also added a hotkey remapping screen to the input settings. Not only can you remap inputs to controllers now, but those who did not know the hotkey bindings can now quickly see which ones exist and what they are mapped to. Changelog (since v077): - memory and most registers are now randomly initialized on power-up - fixed auto joypad polling issue in Super Star Wars - fixed .nec and .rtc file extensions (they were missing the dot) [krom] - PPU/accuracy now clears overscan region on any frame when it is disabled - PPU/compatibility no longer auto-blends hires pixels (use NTSC filter for this) - added hotkey remapping dialog to input settings window - added a few new hotkeys, including quick-reset - phoenix API now auto-sizes widgets based on font sizes - file dialog once again remembers previously selected file when possible
2011-04-30 13:12:15 +00:00
hires = false;
for(auto& n : line_width) n = 256;
}
#endif