mirror of
https://github.com/bsnes-emu/bsnes.git
synced 2025-04-02 10:42:14 -04: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.
152 lines
3.6 KiB
C++
152 lines
3.6 KiB
C++
#ifndef NALL_COMPOSITOR_HPP
|
|
#define NALL_COMPOSITOR_HPP
|
|
|
|
#include <nall/intrinsics.hpp>
|
|
|
|
namespace nall {
|
|
|
|
struct compositor {
|
|
inline static bool enabled();
|
|
inline static bool enable(bool status);
|
|
|
|
#if defined(PLATFORM_X)
|
|
enum class Compositor : unsigned { Unknown, Metacity, Xfwm4 };
|
|
inline static Compositor detect();
|
|
|
|
inline static bool enabled_metacity();
|
|
inline static bool enable_metacity(bool status);
|
|
|
|
inline static bool enabled_xfwm4();
|
|
inline static bool enable_xfwm4(bool status);
|
|
#endif
|
|
};
|
|
|
|
#if defined(PLATFORM_X)
|
|
|
|
//Metacity
|
|
|
|
bool compositor::enabled_metacity() {
|
|
FILE* fp = popen("gconftool-2 --get /apps/metacity/general/compositing_manager", "r");
|
|
if(!fp) return false;
|
|
|
|
char buffer[512];
|
|
if(!fgets(buffer, sizeof buffer, fp)) return false;
|
|
|
|
if(!memcmp(buffer, "true", 4)) return true;
|
|
return false;
|
|
}
|
|
|
|
bool compositor::enable_metacity(bool status) {
|
|
FILE* fp;
|
|
if(status) {
|
|
fp = popen("gconftool-2 --set --type bool /apps/metacity/general/compositing_manager true", "r");
|
|
} else {
|
|
fp = popen("gconftool-2 --set --type bool /apps/metacity/general/compositing_manager false", "r");
|
|
}
|
|
if(!fp) return false;
|
|
pclose(fp);
|
|
return true;
|
|
}
|
|
|
|
//Xfwm4
|
|
|
|
bool compositor::enabled_xfwm4() {
|
|
FILE* fp = popen("xfconf-query -c xfwm4 -p '/general/use_compositing'", "r");
|
|
if(!fp) return false;
|
|
|
|
char buffer[512];
|
|
if(!fgets(buffer, sizeof buffer, fp)) return false;
|
|
|
|
if(!memcmp(buffer, "true", 4)) return true;
|
|
return false;
|
|
}
|
|
|
|
bool compositor::enable_xfwm4(bool status) {
|
|
FILE* fp;
|
|
if(status) {
|
|
fp = popen("xfconf-query -c xfwm4 -p '/general/use_compositing' -t 'bool' -s 'true'", "r");
|
|
} else {
|
|
fp = popen("xfconf-query -c xfwm4 -p '/general/use_compositing' -t 'bool' -s 'false'", "r");
|
|
}
|
|
if(!fp) return false;
|
|
pclose(fp);
|
|
return true;
|
|
}
|
|
|
|
//General
|
|
|
|
compositor::Compositor compositor::detect() {
|
|
Compositor result = Compositor::Unknown;
|
|
|
|
FILE* fp;
|
|
char buffer[512];
|
|
|
|
fp = popen("pidof metacity", "r");
|
|
if(fp && fgets(buffer, sizeof buffer, fp)) result = Compositor::Metacity;
|
|
pclose(fp);
|
|
|
|
fp = popen("pidof xfwm4", "r");
|
|
if(fp && fgets(buffer, sizeof buffer, fp)) result = Compositor::Xfwm4;
|
|
pclose(fp);
|
|
|
|
return result;
|
|
}
|
|
|
|
bool compositor::enabled() {
|
|
switch(detect()) {
|
|
case Compositor::Metacity: return enabled_metacity();
|
|
case Compositor::Xfwm4: return enabled_xfwm4();
|
|
default: return false;
|
|
}
|
|
}
|
|
|
|
bool compositor::enable(bool status) {
|
|
switch(detect()) {
|
|
case Compositor::Metacity: return enable_metacity(status);
|
|
case Compositor::Xfwm4: return enable_xfwm4(status);
|
|
default: return false;
|
|
}
|
|
}
|
|
|
|
#elif defined(PLATFORM_WINDOWS)
|
|
|
|
bool compositor::enabled() {
|
|
HMODULE module = GetModuleHandleW(L"dwmapi");
|
|
if(module == nullptr) module = LoadLibraryW(L"dwmapi");
|
|
if(module == nullptr) return false;
|
|
|
|
auto pDwmIsCompositionEnabled = (HRESULT (WINAPI*)(BOOL*))GetProcAddress(module, "DwmIsCompositionEnabled");
|
|
if(pDwmIsCompositionEnabled == nullptr) return false;
|
|
|
|
BOOL result;
|
|
if(pDwmIsCompositionEnabled(&result) != S_OK) return false;
|
|
return result;
|
|
}
|
|
|
|
bool compositor::enable(bool status) {
|
|
HMODULE module = GetModuleHandleW(L"dwmapi");
|
|
if(module == nullptr) module = LoadLibraryW(L"dwmapi");
|
|
if(module == nullptr) return false;
|
|
|
|
auto pDwmEnableComposition = (HRESULT (WINAPI*)(UINT))GetProcAddress(module, "DwmEnableComposition");
|
|
if(pDwmEnableComposition == nullptr) return false;
|
|
|
|
if(pDwmEnableComposition(status) != S_OK) return false;
|
|
return true;
|
|
}
|
|
|
|
#else
|
|
|
|
bool compositor::enabled() {
|
|
return false;
|
|
}
|
|
|
|
bool compositor::enable(bool) {
|
|
return false;
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif
|