mirror of https://github.com/bsnes-emu/bsnes.git
Update to bsnes v020 01 release.
[No changelog available]
This commit is contained in:
parent
2cc7fe30b4
commit
ebb234ba5f
|
@ -0,0 +1,63 @@
|
||||||
|
bsnes (TM) Open Source Reference License
|
||||||
|
Copyright (C) 2004 - 2007 byuu
|
||||||
|
All rights reserved
|
||||||
|
|
||||||
|
1. Definitions
|
||||||
|
|
||||||
|
The terms "reproduce", "reproduction", "distribute" and "distribution" have the
|
||||||
|
same meaning here as under U.S. copyright law.
|
||||||
|
|
||||||
|
"The software" means this software package as a whole, including, but not
|
||||||
|
limited to, this license, binaries, source code, documentation, and data.
|
||||||
|
|
||||||
|
"You" means the licensee of the software.
|
||||||
|
|
||||||
|
"The licensor" means the copyright holder of the software, byuu.
|
||||||
|
|
||||||
|
2. Grant of Rights
|
||||||
|
|
||||||
|
Subject to the terms of this license, the licensor grants you a
|
||||||
|
non-transferable, non-exclusive, worldwide, royalty-free copyright license to
|
||||||
|
reproduce the software for non-commercial use only, provided the software
|
||||||
|
remains unmodified, and there is no charge for the software itself, its' use,
|
||||||
|
nor for the medium upon which the software is distributed. The reproduction of
|
||||||
|
modified or derivative works of the software is strictly prohibited, except when
|
||||||
|
transmitted solely to the licensor.
|
||||||
|
|
||||||
|
3. Limitations
|
||||||
|
|
||||||
|
This license does not grant you any rights to use the licensor's name, logo or
|
||||||
|
trademarks.
|
||||||
|
|
||||||
|
The software is provided "as is", and any express or implied warranties,
|
||||||
|
including, but not limited to, the implied warranties of merchantability and
|
||||||
|
fitness for a particular purpose are disclaimed. In no event shall the licensor
|
||||||
|
be liable for any direct, indirect, incidental, special, exemplary, or
|
||||||
|
consequential damages (including, but not limited to, procurement of substitute
|
||||||
|
goods or services; loss of use, data, or profits; or business interruption)
|
||||||
|
however caused and on any theory of liability, whether in contract, strict
|
||||||
|
liability, or tort (including negligence or otherwise) arising in any way out of
|
||||||
|
the use of the software, even if advised of the possibility of such damage.
|
||||||
|
|
||||||
|
In the event that this license is determined to be invalid or unenforceable, the
|
||||||
|
Grant of Rights will become null and void, and no rights shall be granted to the
|
||||||
|
licensee, within the scope of U.S. copyright law.
|
||||||
|
|
||||||
|
4. Exemptions
|
||||||
|
|
||||||
|
The software includes the work of other copyright holders, which is licensed
|
||||||
|
under different agreements, and exempt from this license. Below is a complete
|
||||||
|
list of all such software, and their respective copyright holders and licenses.
|
||||||
|
Further, respective source code files are labeled with their correct licensing
|
||||||
|
information in the header. The lack of such a header indicates said file falls
|
||||||
|
under the bsnes license.
|
||||||
|
|
||||||
|
HQ2x Filter, author: MaxST, license: LGPL
|
||||||
|
JMA, author: NSRT Team, license: GPL *
|
||||||
|
libco, author: byuu, license: public domain
|
||||||
|
libui, author: byuu, license: public domain
|
||||||
|
NTSC Filter, author: blargg, license: LGPL
|
||||||
|
S-DD1, author: Andreas Naive, license: public domain
|
||||||
|
zlib, license: zlib license
|
||||||
|
|
||||||
|
* bsnes has received an exemption from the copyright holder to use this work.
|
|
@ -0,0 +1,88 @@
|
||||||
|
bsnes
|
||||||
|
Version 0.020
|
||||||
|
Author: byuu
|
||||||
|
|
||||||
|
|
||||||
|
General:
|
||||||
|
--------
|
||||||
|
bsnes is a Super Nintendo / Super Famicom emulator that began on
|
||||||
|
October 14th, 2004.
|
||||||
|
|
||||||
|
The latest version can be downloaded from:
|
||||||
|
http://byuu.org/
|
||||||
|
|
||||||
|
Please see license.txt for important licensing information.
|
||||||
|
|
||||||
|
|
||||||
|
Known Limitations:
|
||||||
|
------------------
|
||||||
|
S-CPU
|
||||||
|
- Invalid DMA / HDMA transfers (eg WRAM<>WRAM) not fully emulated
|
||||||
|
- Multiply / Divide register delays not implemented
|
||||||
|
|
||||||
|
S-PPU
|
||||||
|
- Uses scanline-based renderer. This is very inaccurate, but very few games
|
||||||
|
rely on mid-scanline writes to function correctly
|
||||||
|
- Does not support FirstSprite+Y priority
|
||||||
|
- OAM / CGRAM accesses during active display not supported correctly
|
||||||
|
- RTO flags are not calculated on frames that are skipped when frameskipping
|
||||||
|
is enabled. This provides a major speedup, however it will cause in issues
|
||||||
|
in games that test these flags, eg the SNES Test Program Electronics Test.
|
||||||
|
Turning frameskipping off will allow RTO flag calculation on every frame
|
||||||
|
|
||||||
|
Hardware Bugs
|
||||||
|
- CPUr1 HDMA crashing bug not emulated
|
||||||
|
- CPU<>APU communication bus conflicts not emulated
|
||||||
|
|
||||||
|
|
||||||
|
Unsupported Hardware:
|
||||||
|
---------------------
|
||||||
|
SA-1
|
||||||
|
Coprocessor used in many popular games, including:
|
||||||
|
- Dragon Ball Z Hyper Dimension
|
||||||
|
- Kirby Super Star
|
||||||
|
- Kirby's Dreamland 3
|
||||||
|
- Marvelous
|
||||||
|
- SD Gundam G-NEXT
|
||||||
|
- Super Mario RPG
|
||||||
|
|
||||||
|
Super FX
|
||||||
|
Coprocessor used in many popular games, including:
|
||||||
|
- Doom
|
||||||
|
- Star Fox
|
||||||
|
- Star Fox 2 (unreleased beta)
|
||||||
|
- Super Mario World 2: Yoshi's Island
|
||||||
|
|
||||||
|
SPC7110
|
||||||
|
Coprocessor used only by the following games:
|
||||||
|
- Far East of Eden Zero
|
||||||
|
- Far East of Eden Zero: Shounen Jump no Shou
|
||||||
|
- Momotarou Densetsu Happy
|
||||||
|
- Super Power League 4
|
||||||
|
|
||||||
|
DSP-3
|
||||||
|
Coprocessor used only by SD Gundam GX
|
||||||
|
|
||||||
|
DSP-4
|
||||||
|
Coprocessor used only by Top Gear 3000
|
||||||
|
|
||||||
|
ST010 / ST011 / ST018
|
||||||
|
SETA coprocessors used by very few games
|
||||||
|
|
||||||
|
BS-X (Broadcast Satellite)
|
||||||
|
Add-on unit sold only in Japan that played specially-made games that were
|
||||||
|
downloaded via satellite
|
||||||
|
|
||||||
|
BS-X Flashcart
|
||||||
|
Flash cartridge used by BS-X, as well as some standalone games by Asciisoft
|
||||||
|
|
||||||
|
Super Gameboy
|
||||||
|
Cartridge passthrough used for playing Gameboy games
|
||||||
|
|
||||||
|
|
||||||
|
Unsupported Controllers:
|
||||||
|
------------------------
|
||||||
|
Mouse
|
||||||
|
Super Scope
|
||||||
|
Justifier
|
||||||
|
Multitap (4-port and 5-port)
|
|
@ -1,4 +1,4 @@
|
||||||
#define BSNES_VERSION "0.020"
|
#define BSNES_VERSION "0.020.01"
|
||||||
#define BSNES_TITLE "bsnes v" BSNES_VERSION
|
#define BSNES_TITLE "bsnes v" BSNES_VERSION
|
||||||
|
|
||||||
#define MEMCORE bMemBus
|
#define MEMCORE bMemBus
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
libbase : version 0.10 ~byuu (2007-05-27)
|
libbase : version 0.10 ~byuu (2007-06-04)
|
||||||
license: public domain
|
license: public domain
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -55,17 +55,14 @@
|
||||||
#define noinline __declspec(noinline)
|
#define noinline __declspec(noinline)
|
||||||
#define inline inline
|
#define inline inline
|
||||||
#define alwaysinline __forceinline
|
#define alwaysinline __forceinline
|
||||||
#define fastcall __fastcall
|
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
#define noinline __attribute__((noinline))
|
#define noinline __attribute__((noinline))
|
||||||
#define inline inline
|
#define inline inline
|
||||||
#define alwaysinline __attribute__((always_inline))
|
#define alwaysinline __attribute__((always_inline))
|
||||||
#define fastcall __attribute__((fastcall))
|
|
||||||
#else
|
#else
|
||||||
#define noinline
|
#define noinline
|
||||||
#define inline inline
|
#define inline inline
|
||||||
#define alwaysinline inline
|
#define alwaysinline inline
|
||||||
#define fastcall
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*****
|
/*****
|
||||||
|
|
|
@ -1,10 +1,20 @@
|
||||||
/*
|
/*
|
||||||
libco_x86 : version 0.10 ~byuu (2007-04-18)
|
libco_x86 : version 0.10 ~byuu (2007-06-04)
|
||||||
|
license: public domain
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef LIBCO_H
|
#ifndef LIBCO_H
|
||||||
#define LIBCO_H
|
#define LIBCO_H
|
||||||
|
|
||||||
|
#undef fastcall
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#define fastcall __fastcall
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#define fastcall __attribute__((fastcall))
|
||||||
|
#else
|
||||||
|
#error "fastcall undefined"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define cocall fastcall
|
#define cocall fastcall
|
||||||
typedef void (*cothread_t);
|
typedef void (*cothread_t);
|
||||||
|
|
||||||
|
|
|
@ -1,341 +0,0 @@
|
||||||
/*
|
|
||||||
libfunctor : version 0.01 ~byuu (2007-01-04)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __LIBFUNCTOR
|
|
||||||
#define __LIBFUNCTOR
|
|
||||||
|
|
||||||
template<typename T> struct functor;
|
|
||||||
template<typename T> struct functor_t;
|
|
||||||
|
|
||||||
/*****
|
|
||||||
* macros
|
|
||||||
*****/
|
|
||||||
|
|
||||||
#define base_functor \
|
|
||||||
functor *f; \
|
|
||||||
virtual operator bool() const { return f && (bool)(*f); } \
|
|
||||||
virtual functor *copy() const { return f->copy(); } \
|
|
||||||
functor &operator=(const functor *source) { if(f) { delete f; } f = (source->f) ? source->copy() : 0; return *this; } \
|
|
||||||
functor &operator=(const functor &source) { if(f) { delete f; } f = (source.f) ? source.copy() : 0; return *this; } \
|
|
||||||
functor(const functor &source) { /* ........................ */ f = (source.f) ? source.copy() : 0; } \
|
|
||||||
functor() : f(0) {} \
|
|
||||||
~functor() { if(f && f != this) { delete f; } }
|
|
||||||
|
|
||||||
#define base_global_functor \
|
|
||||||
operator bool() const { return proc; } \
|
|
||||||
functor_t *copy() const { return new functor_t(*this); } \
|
|
||||||
functor_t(const functor_t &source) { proc = source.proc; }
|
|
||||||
|
|
||||||
#define base_member_functor \
|
|
||||||
operator bool() const { return obj && proc; } \
|
|
||||||
functor_t *copy() const { return new functor_t(*this); } \
|
|
||||||
functor_t(const functor_t &source) { obj = source.obj; proc = source.proc; } \
|
|
||||||
C *obj;
|
|
||||||
|
|
||||||
/*****
|
|
||||||
* parameters = 0
|
|
||||||
*****/
|
|
||||||
|
|
||||||
template<typename R>
|
|
||||||
struct functor<R (*)()> { base_functor
|
|
||||||
virtual R operator()() const { return (*f)(); }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R>
|
|
||||||
struct functor_t<R (*)()> : public functor<R (*)()> { base_global_functor
|
|
||||||
R (*proc)();
|
|
||||||
R operator()() const { return (*proc)(); }
|
|
||||||
functor_t(R (*_proc)()) : proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename C, typename R>
|
|
||||||
struct functor_t<R (C::*)()> : public functor<R (*)()> { base_member_functor
|
|
||||||
R (C::*proc)();
|
|
||||||
R operator()() const { return (obj->*proc)(); }
|
|
||||||
functor_t(C *_obj, R (C::*_proc)()) : obj(_obj), proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R>
|
|
||||||
functor_t<R (*)()> make_functor(R (*proc)()) {
|
|
||||||
return functor_t<R (*)()>(proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename C, typename R>
|
|
||||||
functor_t<R (C::*)()> make_functor(C *obj, R (C::*proc)()) {
|
|
||||||
return functor_t<R (C::*)()>(obj, proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****
|
|
||||||
* parameters = 1
|
|
||||||
*****/
|
|
||||||
|
|
||||||
template<typename R, typename P1>
|
|
||||||
struct functor<R (*)(P1)> { base_functor
|
|
||||||
virtual R operator()(P1 p1) const { return (*f)(p1); }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R, typename P1>
|
|
||||||
struct functor_t<R (*)(P1)> : public functor<R (*)(P1)> { base_global_functor
|
|
||||||
R (*proc)(P1);
|
|
||||||
R operator()(P1 p1) const { return (*proc)(p1); }
|
|
||||||
functor_t(R (*_proc)(P1)) : proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename C, typename R, typename P1>
|
|
||||||
struct functor_t<R (C::*)(P1)> : public functor<R (*)(P1)> { base_member_functor
|
|
||||||
R (C::*proc)(P1);
|
|
||||||
R operator()(P1 p1) const { return (obj->*proc)(p1); }
|
|
||||||
functor_t(C *_obj, R (C::*_proc)(P1)) : obj(_obj), proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R, typename P1>
|
|
||||||
functor_t<R (*)(P1)> make_functor(R (*proc)(P1)) {
|
|
||||||
return functor_t<R (*)(P1)>(proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename C, typename R, typename P1>
|
|
||||||
functor_t<R (C::*)(P1)> make_functor(C *obj, R (C::*proc)(P1)) {
|
|
||||||
return functor_t<R (C::*)(P1)>(obj, proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****
|
|
||||||
* parameters = 2
|
|
||||||
*****/
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2>
|
|
||||||
struct functor<R (*)(P1, P2)> { base_functor
|
|
||||||
virtual R operator()(P1 p1, P2 p2) const { return (*f)(p1, p2); }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2>
|
|
||||||
struct functor_t<R (*)(P1, P2)> : public functor<R (*)(P1, P2)> { base_global_functor
|
|
||||||
R (*proc)(P1, P2);
|
|
||||||
R operator()(P1 p1, P2 p2) const { return (*proc)(p1, p2); }
|
|
||||||
functor_t(R (*_proc)(P1, P2)) : proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename C, typename R, typename P1, typename P2>
|
|
||||||
struct functor_t<R (C::*)(P1, P2)> : public functor<R (*)(P1, P2)> { base_member_functor
|
|
||||||
R (C::*proc)(P1, P2);
|
|
||||||
R operator()(P1 p1, P2 p2) const { return (obj->*proc)(p1, p2); }
|
|
||||||
functor_t(C *_obj, R (C::*_proc)(P1, P2)) : obj(_obj), proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2>
|
|
||||||
functor_t<R (*)(P1, P2)> make_functor(R (*proc)(P1, P2)) {
|
|
||||||
return functor_t<R (*)(P1, P2)>(proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename C, typename R, typename P1, typename P2>
|
|
||||||
functor_t<R (C::*)(P1, P2)> make_functor(C *obj, R (C::*proc)(P1, P2)) {
|
|
||||||
return functor_t<R (C::*)(P1, P2)>(obj, proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****
|
|
||||||
* parameters = 3
|
|
||||||
*****/
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3>
|
|
||||||
struct functor<R (*)(P1, P2, P3)> { base_functor
|
|
||||||
virtual R operator()(P1 p1, P2 p2, P3 p3) const { return (*f)(p1, p2, p3); }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3>
|
|
||||||
struct functor_t<R (*)(P1, P2, P3)> : public functor<R (*)(P1, P2, P3)> { base_global_functor
|
|
||||||
R (*proc)(P1, P2, P3);
|
|
||||||
R operator()(P1 p1, P2 p2, P3 p3) const { return (*proc)(p1, p2, p3); }
|
|
||||||
functor_t(R (*_proc)(P1, P2, P3)) : proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename C, typename R, typename P1, typename P2, typename P3>
|
|
||||||
struct functor_t<R (C::*)(P1, P2, P3)> : public functor<R (*)(P1, P2, P3)> { base_member_functor
|
|
||||||
R (C::*proc)(P1, P2, P3);
|
|
||||||
R operator()(P1 p1, P2 p2, P3 p3) const { return (obj->*proc)(p1, p2, p3); }
|
|
||||||
functor_t(C *_obj, R (C::*_proc)(P1, P2, P3)) : obj(_obj), proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3>
|
|
||||||
functor_t<R (*)(P1, P2, P3)> make_functor(R (*proc)(P1, P2, P3)) {
|
|
||||||
return functor_t<R (*)(P1, P2, P3)>(proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename C, typename R, typename P1, typename P2, typename P3>
|
|
||||||
functor_t<R (C::*)(P1, P2, P3)> make_functor(C *obj, R (C::*proc)(P1, P2, P3)) {
|
|
||||||
return functor_t<R (C::*)(P1, P2, P3)>(obj, proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****
|
|
||||||
* parameters = 4
|
|
||||||
*****/
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3, typename P4>
|
|
||||||
struct functor<R (*)(P1, P2, P3, P4)> { base_functor
|
|
||||||
virtual R operator()(P1 p1, P2 p2, P3 p3, P4 p4) const { return (*f)(p1, p2, p3, p4); }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3, typename P4>
|
|
||||||
struct functor_t<R (*)(P1, P2, P3, P4)> : public functor<R (*)(P1, P2, P3, P4)> { base_global_functor
|
|
||||||
R (*proc)(P1, P2, P3, P4);
|
|
||||||
R operator()(P1 p1, P2 p2, P3 p3, P4 p4) const { return (*proc)(p1, p2, p3, p4); }
|
|
||||||
functor_t(R (*_proc)(P1, P2, P3, P4)) : proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename C, typename R, typename P1, typename P2, typename P3, typename P4>
|
|
||||||
struct functor_t<R (C::*)(P1, P2, P3, P4)> : public functor<R (*)(P1, P2, P3, P4)> { base_member_functor
|
|
||||||
R (C::*proc)(P1, P2, P3, P4);
|
|
||||||
R operator()(P1 p1, P2 p2, P3 p3, P4 p4) const { return (obj->*proc)(p1, p2, p3, p4); }
|
|
||||||
functor_t(C *_obj, R (C::*_proc)(P1, P2, P3, P4)) : obj(_obj), proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3, typename P4>
|
|
||||||
functor_t<R (*)(P1, P2, P3, P4)> make_functor(R (*proc)(P1, P2, P3, P4)) {
|
|
||||||
return functor_t<R (*)(P1, P2, P3, P4)>(proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename C, typename R, typename P1, typename P2, typename P3, typename P4>
|
|
||||||
functor_t<R (C::*)(P1, P2, P3, P4)> make_functor(C *obj, R (C::*proc)(P1, P2, P3, P4)) {
|
|
||||||
return functor_t<R (C::*)(P1, P2, P3, P4)>(obj, proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****
|
|
||||||
* parameters = 5
|
|
||||||
*****/
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5>
|
|
||||||
struct functor<R (*)(P1, P2, P3, P4, P5)> { base_functor
|
|
||||||
virtual R operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) const { return (*f)(p1, p2, p3, p4, p5); }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5>
|
|
||||||
struct functor_t<R (*)(P1, P2, P3, P4, P5)> : public functor<R (*)(P1, P2, P3, P4, P5)> { base_global_functor
|
|
||||||
R (*proc)(P1, P2, P3, P4, P5);
|
|
||||||
R operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) const { return (*proc)(p1, p2, p3, p4, p5); }
|
|
||||||
functor_t(R (*_proc)(P1, P2, P3, P4, P5)) : proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename C, typename R, typename P1, typename P2, typename P3, typename P4, typename P5>
|
|
||||||
struct functor_t<R (C::*)(P1, P2, P3, P4, P5)> : public functor<R (*)(P1, P2, P3, P4, P5)> { base_member_functor
|
|
||||||
R (C::*proc)(P1, P2, P3, P4, P5);
|
|
||||||
R operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) const { return (obj->*proc)(p1, p2, p3, p4, p5); }
|
|
||||||
functor_t(C *_obj, R (C::*_proc)(P1, P2, P3, P4, P5)) : obj(_obj), proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5>
|
|
||||||
functor_t<R (*)(P1, P2, P3, P4, P5)> make_functor(R (*proc)(P1, P2, P3, P4, P5)) {
|
|
||||||
return functor_t<R (*)(P1, P2, P3, P4, P5)>(proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename C, typename R, typename P1, typename P2, typename P3, typename P4, typename P5>
|
|
||||||
functor_t<R (C::*)(P1, P2, P3, P4, P5)> make_functor(C *obj, R (C::*proc)(P1, P2, P3, P4, P5)) {
|
|
||||||
return functor_t<R (C::*)(P1, P2, P3, P4, P5)>(obj, proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****
|
|
||||||
* parameters = 6
|
|
||||||
*****/
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
|
|
||||||
struct functor<R (*)(P1, P2, P3, P4, P5, P6)> { base_functor
|
|
||||||
virtual R operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) const { return (*f)(p1, p2, p3, p4, p5, p6); }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
|
|
||||||
struct functor_t<R (*)(P1, P2, P3, P4, P5, P6)> : public functor<R (*)(P1, P2, P3, P4, P5, P6)> { base_global_functor
|
|
||||||
R (*proc)(P1, P2, P3, P4, P5, P6);
|
|
||||||
R operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) const { return (*proc)(p1, p2, p3, p4, p5, p6); }
|
|
||||||
functor_t(R (*_proc)(P1, P2, P3, P4, P5, P6)) : proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename C, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
|
|
||||||
struct functor_t<R (C::*)(P1, P2, P3, P4, P5, P6)> : public functor<R (*)(P1, P2, P3, P4, P5, P6)> { base_member_functor
|
|
||||||
R (C::*proc)(P1, P2, P3, P4, P5, P6);
|
|
||||||
R operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6) const { return (obj->*proc)(p1, p2, p3, p4, p5, p6); }
|
|
||||||
functor_t(C *_obj, R (C::*_proc)(P1, P2, P3, P4, P5, P6)) : obj(_obj), proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
|
|
||||||
functor_t<R (*)(P1, P2, P3, P4, P5, P6)> make_functor(R (*proc)(P1, P2, P3, P4, P5, P6)) {
|
|
||||||
return functor_t<R (*)(P1, P2, P3, P4, P5, P6)>(proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename C, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6>
|
|
||||||
functor_t<R (C::*)(P1, P2, P3, P4, P5, P6)> make_functor(C *obj, R (C::*proc)(P1, P2, P3, P4, P5, P6)) {
|
|
||||||
return functor_t<R (C::*)(P1, P2, P3, P4, P5, P6)>(obj, proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****
|
|
||||||
* parameters = 7
|
|
||||||
*****/
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
|
|
||||||
struct functor<R (*)(P1, P2, P3, P4, P5, P6, P7)> { base_functor
|
|
||||||
virtual R operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) const { return (*f)(p1, p2, p3, p4, p5, p6, p7); }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
|
|
||||||
struct functor_t<R (*)(P1, P2, P3, P4, P5, P6, P7)> : public functor<R (*)(P1, P2, P3, P4, P5, P6, P7)> { base_global_functor
|
|
||||||
R (*proc)(P1, P2, P3, P4, P5, P6, P7);
|
|
||||||
R operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) const { return (*proc)(p1, p2, p3, p4, p5, p6, p7); }
|
|
||||||
functor_t(R (*_proc)(P1, P2, P3, P4, P5, P6, P7)) : proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename C, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
|
|
||||||
struct functor_t<R (C::*)(P1, P2, P3, P4, P5, P6, P7)> : public functor<R (*)(P1, P2, P3, P4, P5, P6, P7)> { base_member_functor
|
|
||||||
R (C::*proc)(P1, P2, P3, P4, P5, P6, P7);
|
|
||||||
R operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7) const { return (obj->*proc)(p1, p2, p3, p4, p5, p6, p7); }
|
|
||||||
functor_t(C *_obj, R (C::*_proc)(P1, P2, P3, P4, P5, P6, P7)) : obj(_obj), proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
|
|
||||||
functor_t<R (*)(P1, P2, P3, P4, P5, P6, P7)> make_functor(R (*proc)(P1, P2, P3, P4, P5, P6, P7)) {
|
|
||||||
return functor_t<R (*)(P1, P2, P3, P4, P5, P6, P7)>(proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename C, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7>
|
|
||||||
functor_t<R (C::*)(P1, P2, P3, P4, P5, P6, P7)> make_functor(C *obj, R (C::*proc)(P1, P2, P3, P4, P5, P6, P7)) {
|
|
||||||
return functor_t<R (C::*)(P1, P2, P3, P4, P5, P6, P7)>(obj, proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****
|
|
||||||
* parameters = 8
|
|
||||||
*****/
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
|
|
||||||
struct functor<R (*)(P1, P2, P3, P4, P5, P6, P7, P8)> { base_functor
|
|
||||||
virtual R operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) const { return (*f)(p1, p2, p3, p4, p5, p6, p7, p8); }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
|
|
||||||
struct functor_t<R (*)(P1, P2, P3, P4, P5, P6, P7, P8)> : public functor<R (*)(P1, P2, P3, P4, P5, P6, P7, P8)> { base_global_functor
|
|
||||||
R (*proc)(P1, P2, P3, P4, P5, P6, P7, P8);
|
|
||||||
R operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) const { return (*proc)(p1, p2, p3, p4, p5, p6, p7, p8); }
|
|
||||||
functor_t(R (*_proc)(P1, P2, P3, P4, P5, P6, P7, P8)) : proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename C, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
|
|
||||||
struct functor_t<R (C::*)(P1, P2, P3, P4, P5, P6, P7, P8)> : public functor<R (*)(P1, P2, P3, P4, P5, P6, P7, P8)> { base_member_functor
|
|
||||||
R (C::*proc)(P1, P2, P3, P4, P5, P6, P7, P8);
|
|
||||||
R operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8) const { return (obj->*proc)(p1, p2, p3, p4, p5, p6, p7, p8); }
|
|
||||||
functor_t(C *_obj, R (C::*_proc)(P1, P2, P3, P4, P5, P6, P7, P8)) : obj(_obj), proc(_proc) { this->f = this; }
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
|
|
||||||
functor_t<R (*)(P1, P2, P3, P4, P5, P6, P7, P8)> make_functor(R (*proc)(P1, P2, P3, P4, P5, P6, P7, P8)) {
|
|
||||||
return functor_t<R (*)(P1, P2, P3, P4, P5, P6, P7, P8)>(proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
template<typename C, typename R, typename P1, typename P2, typename P3, typename P4, typename P5, typename P6, typename P7, typename P8>
|
|
||||||
functor_t<R (C::*)(P1, P2, P3, P4, P5, P6, P7, P8)> make_functor(C *obj, R (C::*proc)(P1, P2, P3, P4, P5, P6, P7, P8)) {
|
|
||||||
return functor_t<R (C::*)(P1, P2, P3, P4, P5, P6, P7, P8)>(obj, proc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****
|
|
||||||
* epilogue
|
|
||||||
*****/
|
|
||||||
|
|
||||||
#undef base_functor
|
|
||||||
#undef base_global_functor
|
|
||||||
#undef base_member_functor
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -40,13 +40,14 @@ uint get_screen_height() { return gdk_screen_height(); }
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
noinline bool gtk_file_load(Window &owner, char *filename, const char *filter, const char *path) {
|
bool file_load(Window *owner, char *filename, const char *filter, const char *path) {
|
||||||
strcpy(filename, "");
|
strcpy(filename, "");
|
||||||
|
|
||||||
GtkWidget *dialog = gtk_file_chooser_dialog_new("Load File",
|
GtkWidget *dialog = gtk_file_chooser_dialog_new("Load File",
|
||||||
GTK_WINDOW(owner.info.window), GTK_FILE_CHOOSER_ACTION_OPEN,
|
owner ? GTK_WINDOW(owner->info.window) : (GtkWindow*)0,
|
||||||
|
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, 0);
|
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, (const gchar*)0);
|
||||||
|
|
||||||
if(path && strcmp(path, "")) {
|
if(path && strcmp(path, "")) {
|
||||||
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), path);
|
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), path);
|
||||||
|
@ -62,13 +63,14 @@ GtkWidget *dialog = gtk_file_chooser_dialog_new("Load File",
|
||||||
return strcmp(filename, ""); //return true if filename != ""
|
return strcmp(filename, ""); //return true if filename != ""
|
||||||
}
|
}
|
||||||
|
|
||||||
noinline bool gtk_file_save(Window &owner, char *filename, const char *filter, const char *path) {
|
bool file_save(Window *owner, char *filename, const char *filter, const char *path) {
|
||||||
strcpy(filename, "");
|
strcpy(filename, "");
|
||||||
|
|
||||||
GtkWidget *dialog = gtk_file_chooser_dialog_new("Save File",
|
GtkWidget *dialog = gtk_file_chooser_dialog_new("Save File",
|
||||||
GTK_WINDOW(owner.info.window), GTK_FILE_CHOOSER_ACTION_SAVE,
|
owner ? GTK_WINDOW(owner->info.window) : (GtkWindow*)0,
|
||||||
|
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||||
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
|
||||||
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, 0);
|
GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, (const gchar*)0);
|
||||||
|
|
||||||
if(path && strcmp(path, "")) {
|
if(path && strcmp(path, "")) {
|
||||||
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), path);
|
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), path);
|
||||||
|
@ -85,19 +87,6 @@ GtkWidget *dialog = gtk_file_chooser_dialog_new("Save File",
|
||||||
return strcmp(filename, ""); //return true if filename != ""
|
return strcmp(filename, ""); //return true if filename != ""
|
||||||
}
|
}
|
||||||
|
|
||||||
//FreeBSD 6.2-amd64 bug workaround for file_load() + file_save()
|
|
||||||
//gdb reveals stack corruption when calling gtk_file_chooset_dialog_new() from inside
|
|
||||||
//a member function. however, calling function with nesting sidesteps the bug ...
|
|
||||||
//gdb shows that the corruption occurs inside a GTK+ internal library function ...
|
|
||||||
|
|
||||||
bool file_load(Window &owner, char *filename, const char *filter, const char *path) {
|
|
||||||
return gtk_file_load(owner, filename, filter, path);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool file_save(Window &owner, char *filename, const char *filter, const char *path) {
|
|
||||||
return gtk_file_save(owner, filename, filter, path);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
uint16 translate_key(uint key) {
|
uint16 translate_key(uint key) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
libui_gtk ~byuu (2007-05-27)
|
libui_gtk ~byuu (2007-06-05)
|
||||||
license: public domain
|
license: public domain
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ bool events_pending();
|
||||||
uint get_screen_width();
|
uint get_screen_width();
|
||||||
uint get_screen_height();
|
uint get_screen_height();
|
||||||
|
|
||||||
bool file_load(Window &owner, char *filename, const char *filter, const char *path = "");
|
bool file_load(Window *owner, char *filename, const char *filter, const char *path = "");
|
||||||
bool file_save(Window &owner, char *filename, const char *filter, const char *path = "");
|
bool file_save(Window *owner, char *filename, const char *filter, const char *path = "");
|
||||||
|
|
||||||
uint16 translate_key(uint key);
|
uint16 translate_key(uint key);
|
||||||
|
|
||||||
|
@ -60,13 +60,8 @@ MenuBar menu;
|
||||||
void resize(uint width, uint height);
|
void resize(uint width, uint height);
|
||||||
virtual void show();
|
virtual void show();
|
||||||
virtual void hide();
|
virtual void hide();
|
||||||
virtual bool close() { return true; }
|
|
||||||
virtual void keydown(uint16 key) {}
|
|
||||||
virtual void keyup(uint16 key) {}
|
|
||||||
|
|
||||||
virtual int message(uint id, void *param = 0) {}
|
virtual bool message(uint id, uintptr_t param = 0) { return true; }
|
||||||
virtual void clicked(Control&) {}
|
|
||||||
virtual void changed(Control&) {}
|
|
||||||
|
|
||||||
//private:
|
//private:
|
||||||
struct {
|
struct {
|
||||||
|
|
|
@ -6,25 +6,25 @@ gint libui_window_close(GtkWidget *w, GdkEventAny *any, Window *window) {
|
||||||
}
|
}
|
||||||
|
|
||||||
gint libui_window_keydown(GtkWidget *w, GdkEventKey *key, Window *window) {
|
gint libui_window_keydown(GtkWidget *w, GdkEventKey *key, Window *window) {
|
||||||
if(window) { window->message(Message::KeyDown, (void*)libui::translate_key(key->keyval)); }
|
if(window) { window->message(Message::KeyDown, libui::translate_key(key->keyval)); }
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
gint libui_window_keyup(GtkWidget *w, GdkEventKey *key, Window *window) {
|
gint libui_window_keyup(GtkWidget *w, GdkEventKey *key, Window *window) {
|
||||||
if(window) { window->message(Message::KeyUp, (void*)libui::translate_key(key->keyval)); }
|
if(window) { window->message(Message::KeyUp, libui::translate_key(key->keyval)); }
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void libui_control_clicked(Control *control) {
|
void libui_control_clicked(Control *control) {
|
||||||
if(control && control->owner) { control->owner->message(Message::Clicked, control); }
|
if(control && control->owner) { control->owner->message(Message::Clicked, (uintptr_t)control); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void libui_control_changed(Control *control) {
|
void libui_control_changed(Control *control) {
|
||||||
if(control && control->owner) { control->owner->message(Message::Changed, control); }
|
if(control && control->owner) { control->owner->message(Message::Changed, (uintptr_t)control); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void libui_control_double_clicked(Control *control) {
|
void libui_control_double_clicked(Control *control) {
|
||||||
if(control && control->owner) { control->owner->message(Message::DoubleClicked, control); }
|
if(control && control->owner) { control->owner->message(Message::DoubleClicked, (uintptr_t)control); }
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::create(uint style, uint width, uint height, const char *caption) {
|
void Window::create(uint style, uint width, uint height, const char *caption) {
|
||||||
|
|
|
@ -81,7 +81,7 @@ uint get_screen_height() { return GetSystemMetrics(SM_CYSCREEN); }
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
bool file_load(Window &owner, char *filename, const char *filter, const char *path) {
|
bool file_load(Window *owner, char *filename, const char *filter, const char *path) {
|
||||||
string dir, f;
|
string dir, f;
|
||||||
strcpy(dir, path ? path : "");
|
strcpy(dir, path ? path : "");
|
||||||
replace(dir, "/", "\\");
|
replace(dir, "/", "\\");
|
||||||
|
@ -111,7 +111,7 @@ OPENFILENAME ofn;
|
||||||
strcpy(filename, "");
|
strcpy(filename, "");
|
||||||
memset(&ofn, 0, sizeof(ofn));
|
memset(&ofn, 0, sizeof(ofn));
|
||||||
ofn.lStructSize = sizeof(ofn);
|
ofn.lStructSize = sizeof(ofn);
|
||||||
ofn.hwndOwner = owner.info.hwnd;
|
ofn.hwndOwner = owner ? owner->info.hwnd : 0;
|
||||||
ofn.lpstrFilter = pf;
|
ofn.lpstrFilter = pf;
|
||||||
ofn.lpstrInitialDir = strptr(dir);
|
ofn.lpstrInitialDir = strptr(dir);
|
||||||
ofn.lpstrFile = filename;
|
ofn.lpstrFile = filename;
|
||||||
|
@ -122,7 +122,7 @@ OPENFILENAME ofn;
|
||||||
return GetOpenFileName(&ofn);
|
return GetOpenFileName(&ofn);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool file_save(Window &owner, char *filename, const char *filter, const char *path) {
|
bool file_save(Window *owner, char *filename, const char *filter, const char *path) {
|
||||||
string dir, f;
|
string dir, f;
|
||||||
strcpy(dir, path ? path : "");
|
strcpy(dir, path ? path : "");
|
||||||
replace(dir, "/", "\\");
|
replace(dir, "/", "\\");
|
||||||
|
@ -152,7 +152,7 @@ OPENFILENAME ofn;
|
||||||
strcpy(filename, "");
|
strcpy(filename, "");
|
||||||
memset(&ofn, 0, sizeof(ofn));
|
memset(&ofn, 0, sizeof(ofn));
|
||||||
ofn.lStructSize = sizeof(ofn);
|
ofn.lStructSize = sizeof(ofn);
|
||||||
ofn.hwndOwner = owner.info.hwnd;
|
ofn.hwndOwner = owner ? owner->info.hwnd : 0;
|
||||||
ofn.lpstrFilter = pf;
|
ofn.lpstrFilter = pf;
|
||||||
ofn.lpstrInitialDir = strptr(dir);
|
ofn.lpstrInitialDir = strptr(dir);
|
||||||
ofn.lpstrFile = filename;
|
ofn.lpstrFile = filename;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
libui_win ~byuu (2007-05-28)
|
libui_win ~byuu (2007-06-05)
|
||||||
license: public domain
|
license: public domain
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ bool events_pending();
|
||||||
uint get_screen_width();
|
uint get_screen_width();
|
||||||
uint get_screen_height();
|
uint get_screen_height();
|
||||||
|
|
||||||
bool file_load(Window &owner, char *filename, const char *filter, const char *path = "");
|
bool file_load(Window *owner, char *filename, const char *filter, const char *path = "");
|
||||||
bool file_save(Window &owner, char *filename, const char *filter, const char *path = "");
|
bool file_save(Window *owner, char *filename, const char *filter, const char *path = "");
|
||||||
|
|
||||||
uint16 translate_key(uint key);
|
uint16 translate_key(uint key);
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ MenuBar menu;
|
||||||
virtual void show();
|
virtual void show();
|
||||||
virtual void hide();
|
virtual void hide();
|
||||||
|
|
||||||
virtual int message(uint id, void *param = 0) { return 0; }
|
virtual bool message(uint id, uintptr_t param = 0) { return true; }
|
||||||
|
|
||||||
void move(Control &control, uint x, uint y);
|
void move(Control &control, uint x, uint y);
|
||||||
void attach(Control &control);
|
void attach(Control &control);
|
||||||
|
|
|
@ -137,13 +137,13 @@ void MenuCheckItem::create(MenuGroup &r_owner, const char *caption) {
|
||||||
void MenuCheckItem::check() {
|
void MenuCheckItem::check() {
|
||||||
if(checked() == true)return;
|
if(checked() == true)return;
|
||||||
CheckMenuItem(parent, id, MF_CHECKED);
|
CheckMenuItem(parent, id, MF_CHECKED);
|
||||||
owner->message(Message::Clicked, this);
|
owner->message(Message::Clicked, (uintptr_t)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuCheckItem::uncheck() {
|
void MenuCheckItem::uncheck() {
|
||||||
if(checked() == false)return;
|
if(checked() == false)return;
|
||||||
CheckMenuItem(parent, id, MF_UNCHECKED);
|
CheckMenuItem(parent, id, MF_UNCHECKED);
|
||||||
owner->message(Message::Clicked, this);
|
owner->message(Message::Clicked, (uintptr_t)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuCheckItem::check(bool state) {
|
void MenuCheckItem::check(bool state) {
|
||||||
|
@ -180,7 +180,7 @@ void MenuRadioItem::check() {
|
||||||
for(uint i = 0; i < group.count(); i++) {
|
for(uint i = 0; i < group.count(); i++) {
|
||||||
CheckMenuItem(parent, group[i].id, (id == group[i].id) ? MF_CHECKED : MF_UNCHECKED);
|
CheckMenuItem(parent, group[i].id, (id == group[i].id) ? MF_CHECKED : MF_UNCHECKED);
|
||||||
}
|
}
|
||||||
owner->message(Message::Clicked, this);
|
owner->message(Message::Clicked, (uintptr_t)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MenuRadioItem::checked() {
|
bool MenuRadioItem::checked() {
|
||||||
|
@ -419,13 +419,13 @@ void Checkbox::create(Window &r_owner, uint style, uint x, uint y, uint width, u
|
||||||
void Checkbox::check() {
|
void Checkbox::check() {
|
||||||
if(checked() == true)return;
|
if(checked() == true)return;
|
||||||
SendMessage(hwnd, BM_SETCHECK, (WPARAM)TRUE, 0);
|
SendMessage(hwnd, BM_SETCHECK, (WPARAM)TRUE, 0);
|
||||||
owner->message(Message::Clicked, this);
|
owner->message(Message::Clicked, (uintptr_t)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Checkbox::uncheck() {
|
void Checkbox::uncheck() {
|
||||||
if(checked() == false)return;
|
if(checked() == false)return;
|
||||||
SendMessage(hwnd, BM_SETCHECK, (WPARAM)FALSE, 0);
|
SendMessage(hwnd, BM_SETCHECK, (WPARAM)FALSE, 0);
|
||||||
owner->message(Message::Clicked, this);
|
owner->message(Message::Clicked, (uintptr_t)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Checkbox::check(bool state) {
|
void Checkbox::check(bool state) {
|
||||||
|
@ -456,7 +456,7 @@ void Radiobox::check() {
|
||||||
for(uint i = 0; i < group.count(); i++) {
|
for(uint i = 0; i < group.count(); i++) {
|
||||||
SendMessage(group[i].hwnd, BM_SETCHECK, (group[i].hwnd == hwnd) ? (WPARAM)TRUE : (WPARAM)FALSE, 0);
|
SendMessage(group[i].hwnd, BM_SETCHECK, (group[i].hwnd == hwnd) ? (WPARAM)TRUE : (WPARAM)FALSE, 0);
|
||||||
}
|
}
|
||||||
owner->message(Message::Clicked, this);
|
owner->message(Message::Clicked, (uintptr_t)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Radiobox::checked() {
|
bool Radiobox::checked() {
|
||||||
|
|
|
@ -33,11 +33,11 @@ long Window::wndproc(HWND hwnd, uint msg, WPARAM wparam, LPARAM lparam) {
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WM_KEYDOWN: {
|
case WM_KEYDOWN: {
|
||||||
message(Message::KeyDown, (void*)libui::translate_key(wparam));
|
message(Message::KeyDown, libui::translate_key(wparam));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WM_KEYUP: {
|
case WM_KEYUP: {
|
||||||
message(Message::KeyUp, (void*)libui::translate_key(wparam));
|
message(Message::KeyUp, libui::translate_key(wparam));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case WM_COMMAND: {
|
case WM_COMMAND: {
|
||||||
|
@ -68,7 +68,7 @@ long Window::wndproc(HWND hwnd, uint msg, WPARAM wparam, LPARAM lparam) {
|
||||||
//emit Message::Clicked message directly
|
//emit Message::Clicked message directly
|
||||||
case ControlType::MenuItem:
|
case ControlType::MenuItem:
|
||||||
case ControlType::Button: {
|
case ControlType::Button: {
|
||||||
message(Message::Clicked, &control);
|
message(Message::Clicked, (uintptr_t)&control);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ long Window::wndproc(HWND hwnd, uint msg, WPARAM wparam, LPARAM lparam) {
|
||||||
switch(control.type) {
|
switch(control.type) {
|
||||||
|
|
||||||
case ControlType::Slider: {
|
case ControlType::Slider: {
|
||||||
message(Message::Changed, &control);
|
message(Message::Changed, (uintptr_t)&control);
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -104,12 +104,12 @@ long Window::wndproc(HWND hwnd, uint msg, WPARAM wparam, LPARAM lparam) {
|
||||||
if(((LPNMLISTVIEW)lparam)->uChanged & LVIF_STATE) {
|
if(((LPNMLISTVIEW)lparam)->uChanged & LVIF_STATE) {
|
||||||
if(ListView_GetItemState(listbox.hwnd, ((LPNMLISTVIEW)lparam)->iItem, LVIS_FOCUSED)) {
|
if(ListView_GetItemState(listbox.hwnd, ((LPNMLISTVIEW)lparam)->iItem, LVIS_FOCUSED)) {
|
||||||
if(ListView_GetItemState(listbox.hwnd, ((LPNMLISTVIEW)lparam)->iItem, LVIS_SELECTED)) {
|
if(ListView_GetItemState(listbox.hwnd, ((LPNMLISTVIEW)lparam)->iItem, LVIS_SELECTED)) {
|
||||||
message(Message::Changed, &control);
|
message(Message::Changed, (uintptr_t)&control);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(((LPNMHDR)lparam)->code == LVN_ITEMACTIVATE) {
|
} else if(((LPNMHDR)lparam)->code == LVN_ITEMACTIVATE) {
|
||||||
message(Message::DoubleClicked, &control);
|
message(Message::DoubleClicked, (uintptr_t)&control);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
namespace event {
|
namespace event {
|
||||||
|
|
||||||
void update_frame_counter() {
|
void update_frame_counter() {
|
||||||
if(r_ppu->status.frames_updated) {
|
if(r_ppu->status.frames_updated) {
|
||||||
r_ppu->status.frames_updated = false;
|
r_ppu->status.frames_updated = false;
|
||||||
if(bool(true) == true) { //TODO: add config file variable to toggle fps counter
|
if(bool(true) == true) { //TODO: add config file variable to toggle fps counter
|
||||||
window_main.set_text("%s [%d]", BSNES_TITLE, r_ppu->status.frames_executed);
|
window_main.set_text("%s [%d]", BSNES_TITLE, r_ppu->status.frames_executed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_video_settings() {
|
void update_video_settings() {
|
||||||
|
@ -57,7 +57,7 @@ stringarray dir;
|
||||||
strcat(dir[0], dir[1]);
|
strcat(dir[0], dir[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ui::file_load(window_main, fn,
|
return ui::file_load(&window_main, fn,
|
||||||
"SNES images;*.smc,*.sfc,*.swc,*.fig,*.ufo,*.gd3,*.078,*.st"
|
"SNES images;*.smc,*.sfc,*.swc,*.fig,*.ufo,*.gd3,*.078,*.st"
|
||||||
#if defined(GZIP_SUPPORT)
|
#if defined(GZIP_SUPPORT)
|
||||||
",*.gz,*.z,*.zip"
|
",*.gz,*.z,*.zip"
|
||||||
|
@ -70,7 +70,7 @@ stringarray dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_rom() {
|
void load_rom() {
|
||||||
char fn[4096];
|
char fn[PATH_MAX];
|
||||||
if(load_rom(fn) == false)return;
|
if(load_rom(fn) == false)return;
|
||||||
|
|
||||||
if(cartridge.loaded() == true)cartridge.unload();
|
if(cartridge.loaded() == true)cartridge.unload();
|
||||||
|
@ -81,8 +81,12 @@ char fn[4096];
|
||||||
}
|
}
|
||||||
|
|
||||||
void unload_rom() {
|
void unload_rom() {
|
||||||
cartridge.unload();
|
if(cartridge.loaded() == true) {
|
||||||
uiAudio->clear_audio();
|
cartridge.unload();
|
||||||
|
uiVideo->clear_video();
|
||||||
|
uiAudio->clear_audio();
|
||||||
|
}
|
||||||
|
window_main.set_text(BSNES_TITLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
|
|
|
@ -92,6 +92,13 @@ int main(int argc, char *argv[]) {
|
||||||
init_snes();
|
init_snes();
|
||||||
ui_init();
|
ui_init();
|
||||||
|
|
||||||
|
if(argc >= 2) {
|
||||||
|
cartridge.load_begin(Cartridge::CART_NORMAL);
|
||||||
|
cartridge.load(argv[1]);
|
||||||
|
cartridge.load_end();
|
||||||
|
snes.power();
|
||||||
|
}
|
||||||
|
|
||||||
while(_term_ == false) {
|
while(_term_ == false) {
|
||||||
while(ui::events_pending() == true) { ui::run(); }
|
while(ui::events_pending() == true) { ui::run(); }
|
||||||
if(cartridge.loaded() == true) {
|
if(cartridge.loaded() == true) {
|
||||||
|
@ -100,7 +107,7 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cartridge.loaded() == true) { cartridge.unload(); }
|
event::unload_rom();
|
||||||
|
|
||||||
config_file.save(config::filename);
|
config_file.save(config::filename);
|
||||||
term_snes();
|
term_snes();
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
int AdvancedWindow::message(uint id, void *param) {
|
bool AdvancedWindow::message(uint id, uintptr_t param) {
|
||||||
if(id == ui::Message::Changed && param == &list) {
|
ui::Control *control = (ui::Control*)param;
|
||||||
|
if(id == ui::Message::Changed && control == &list) {
|
||||||
int pos = list.get_selection();
|
int pos = list.get_selection();
|
||||||
set_val.enable(pos >= 0);
|
set_val.enable(pos >= 0);
|
||||||
set_def.enable(pos >= 0);
|
set_def.enable(pos >= 0);
|
||||||
|
@ -9,15 +10,15 @@ int AdvancedWindow::message(uint id, void *param) {
|
||||||
config_file.list[pos]->get(val);
|
config_file.list[pos]->get(val);
|
||||||
edit_val.set_text("%s", strptr(val));
|
edit_val.set_text("%s", strptr(val));
|
||||||
}
|
}
|
||||||
} else if(id == ui::Message::Clicked && param == &set_val) {
|
} else if(id == ui::Message::Clicked && control == &set_val) {
|
||||||
char t[4096];
|
char t[4096];
|
||||||
edit_val.get_text(t, sizeof(t));
|
edit_val.get_text(t, sizeof(t));
|
||||||
update(list.get_selection(), t);
|
update(list.get_selection(), t);
|
||||||
} else if(id == ui::Message::Clicked && param == &set_def) {
|
} else if(id == ui::Message::Clicked && control == &set_def) {
|
||||||
update(list.get_selection(), 0);
|
update(list.get_selection(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AdvancedWindow::read_config(uint pos, string &data) {
|
void AdvancedWindow::read_config(uint pos, string &data) {
|
||||||
|
|
|
@ -4,7 +4,7 @@ ui::Editbox desc;
|
||||||
ui::Editbox edit_val;
|
ui::Editbox edit_val;
|
||||||
ui::Button set_val;
|
ui::Button set_val;
|
||||||
ui::Button set_def;
|
ui::Button set_def;
|
||||||
int message(uint id, void *param);
|
bool message(uint id, uintptr_t param);
|
||||||
void read_config(uint pos, string &data);
|
void read_config(uint pos, string &data);
|
||||||
void update(uint pos, const char *data);
|
void update(uint pos, const char *data);
|
||||||
void setup();
|
void setup();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
int CheatEditorWindow::message(uint id, void *param) {
|
bool CheatEditorWindow::message(uint id, uintptr_t param) {
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheatEditorWindow::setup() {
|
void CheatEditorWindow::setup() {
|
||||||
|
|
|
@ -5,6 +5,6 @@ ui::Button toggle_code;
|
||||||
ui::Button delete_code;
|
ui::Button delete_code;
|
||||||
ui::Editbox code;
|
ui::Editbox code;
|
||||||
ui::Editbox desc;
|
ui::Editbox desc;
|
||||||
int message(uint id, void *param);
|
bool message(uint id, uintptr_t param);
|
||||||
void setup();
|
void setup();
|
||||||
} window_cheat_editor;
|
} window_cheat_editor;
|
||||||
|
|
|
@ -58,7 +58,7 @@ uint InputConfigWindow::get_value(uint index) {
|
||||||
return keymap::none;
|
return keymap::none;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputConfigWindow::set_value(uint index, uint value) {
|
void InputConfigWindow::set_value(uint index, uint16 value) {
|
||||||
switch(index) {
|
switch(index) {
|
||||||
case 0: config::input.joypad1.up = keymap::find(value); break;
|
case 0: config::input.joypad1.up = keymap::find(value); break;
|
||||||
case 1: config::input.joypad1.down = keymap::find(value); break;
|
case 1: config::input.joypad1.down = keymap::find(value); break;
|
||||||
|
@ -97,26 +97,27 @@ void InputConfigWindow::refresh_list() {
|
||||||
list.autosize_columns();
|
list.autosize_columns();
|
||||||
}
|
}
|
||||||
|
|
||||||
int InputConfigWindow::message(uint id, void *param) {
|
bool InputConfigWindow::message(uint id, uintptr_t param) {
|
||||||
if(id == ui::Message::Changed && param == &list) {
|
ui::Control *control = (ui::Control*)param;
|
||||||
|
if(id == ui::Message::Changed && control == &list) {
|
||||||
int pos = list.get_selection();
|
int pos = list.get_selection();
|
||||||
setkey.enable(pos >= 0);
|
setkey.enable(pos >= 0);
|
||||||
clrkey.enable(pos >= 0);
|
clrkey.enable(pos >= 0);
|
||||||
} else if((id == ui::Message::DoubleClicked && param == &list) ||
|
} else if((id == ui::Message::DoubleClicked && control == &list) ||
|
||||||
(id == ui::Message::Clicked && param == &setkey)) {
|
(id == ui::Message::Clicked && control == &setkey)) {
|
||||||
int pos = list.get_selection();
|
int pos = list.get_selection();
|
||||||
if(pos < 0) { return 0; }
|
if(pos < 0) { return true; }
|
||||||
window_input_capture.index = pos;
|
window_input_capture.index = pos;
|
||||||
window_input_capture.label.set_text("Please press a key to assign to '%s' ...", list_index[pos]);
|
window_input_capture.label.set_text("Please press a key to assign to '%s' ...", list_index[pos]);
|
||||||
window_input_capture.show();
|
window_input_capture.show();
|
||||||
window_input_capture.focus();
|
window_input_capture.focus();
|
||||||
} else if(id == ui::Message::Clicked && param == &clrkey) {
|
} else if(id == ui::Message::Clicked && control == &clrkey) {
|
||||||
int pos = list.get_selection();
|
int pos = list.get_selection();
|
||||||
if(pos < 0) { return 0; }
|
if(pos < 0) { return true; }
|
||||||
set_value(pos, keymap::none);
|
set_value(pos, keymap::none);
|
||||||
refresh_list();
|
refresh_list();
|
||||||
}
|
}
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputConfigWindow::setup() {
|
void InputConfigWindow::setup() {
|
||||||
|
@ -156,16 +157,20 @@ int x = 0, y = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
int InputCaptureWindow::message(uint id, void *param) {
|
bool InputCaptureWindow::message(uint id, uintptr_t param) {
|
||||||
if(id == ui::Message::Close) {
|
if(id == ui::Message::Close) {
|
||||||
hide();
|
hide();
|
||||||
return false;
|
return false;
|
||||||
} else if(id == ui::Message::KeyUp) {
|
|
||||||
hide();
|
|
||||||
window_input_config.set_value(index, uint(param));
|
|
||||||
window_input_config.refresh_list();
|
|
||||||
}
|
}
|
||||||
return 0;
|
|
||||||
|
if(id == ui::Message::KeyUp) {
|
||||||
|
hide();
|
||||||
|
window_input_config.set_value(index, param);
|
||||||
|
window_input_config.refresh_list();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputCaptureWindow::setup() {
|
void InputCaptureWindow::setup() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class InputCaptureWindow : public ui::Window { public:
|
class InputCaptureWindow : public ui::Window { public:
|
||||||
ui::Label label;
|
ui::Label label;
|
||||||
uint index;
|
uint index;
|
||||||
int message(uint id, void *param = 0);
|
bool message(uint id, uintptr_t param = 0);
|
||||||
void setup();
|
void setup();
|
||||||
InputCaptureWindow() : index(0) {}
|
InputCaptureWindow() : index(0) {}
|
||||||
} window_input_capture;
|
} window_input_capture;
|
||||||
|
@ -17,9 +17,9 @@ ui::Button clrkey;
|
||||||
|
|
||||||
static const char list_index[][64];
|
static const char list_index[][64];
|
||||||
|
|
||||||
int message(uint id, void *param = 0);
|
bool message(uint id, uintptr_t param = 0);
|
||||||
uint get_value(uint index);
|
uint get_value(uint index);
|
||||||
void set_value(uint index, uint value);
|
void set_value(uint index, uint16 value);
|
||||||
void refresh_list();
|
void refresh_list();
|
||||||
void setup();
|
void setup();
|
||||||
} window_input_config;
|
} window_input_config;
|
||||||
|
|
|
@ -1,49 +1,50 @@
|
||||||
int RasterSettingsWindow::message(uint id, void *param) {
|
bool RasterSettingsWindow::message(uint id, uintptr_t param) {
|
||||||
|
ui::Control *control = (ui::Control*)param;
|
||||||
if(id == ui::Message::Changed) {
|
if(id == ui::Message::Changed) {
|
||||||
if(param == &contrast) {
|
if(control == &contrast) {
|
||||||
if(config::snes.contrast != contrast.get_position() - 96) {
|
if(config::snes.contrast != contrast.get_position() - 96) {
|
||||||
config::snes.contrast = contrast.get_position() - 96;
|
config::snes.contrast = contrast.get_position() - 96;
|
||||||
lcontrast.set_text("Contrast: %d", int(config::snes.contrast));
|
lcontrast.set_text("Contrast: %d", int(config::snes.contrast));
|
||||||
snes.update_color_lookup_table();
|
snes.update_color_lookup_table();
|
||||||
}
|
}
|
||||||
} else if(param == &brightness) {
|
} else if(control == &brightness) {
|
||||||
if(config::snes.brightness != brightness.get_position() - 96) {
|
if(config::snes.brightness != brightness.get_position() - 96) {
|
||||||
config::snes.brightness = brightness.get_position() - 96;
|
config::snes.brightness = brightness.get_position() - 96;
|
||||||
lbrightness.set_text("Brightness: %d", int(config::snes.brightness));
|
lbrightness.set_text("Brightness: %d", int(config::snes.brightness));
|
||||||
snes.update_color_lookup_table();
|
snes.update_color_lookup_table();
|
||||||
}
|
}
|
||||||
} else if(param == &gamma) {
|
} else if(control == &gamma) {
|
||||||
if(config::snes.gamma != gamma.get_position() + 10) {
|
if(config::snes.gamma != gamma.get_position() + 10) {
|
||||||
config::snes.gamma = gamma.get_position() + 10;
|
config::snes.gamma = gamma.get_position() + 10;
|
||||||
lgamma.set_text("Gamma: %0.2f", double(config::snes.gamma) / 100.0);
|
lgamma.set_text("Gamma: %0.2f", double(config::snes.gamma) / 100.0);
|
||||||
snes.update_color_lookup_table();
|
snes.update_color_lookup_table();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(id == ui::Message::Clicked) {
|
if(id == ui::Message::Clicked) {
|
||||||
if(param == &gamma_ramp) {
|
if(control == &gamma_ramp) {
|
||||||
if(config::snes.gamma_ramp != gamma_ramp.checked()) {
|
if(config::snes.gamma_ramp != gamma_ramp.checked()) {
|
||||||
config::snes.gamma_ramp = gamma_ramp.checked();
|
config::snes.gamma_ramp = gamma_ramp.checked();
|
||||||
snes.update_color_lookup_table();
|
snes.update_color_lookup_table();
|
||||||
}
|
}
|
||||||
} else if(param == &sepia) {
|
} else if(control == &sepia) {
|
||||||
if(config::snes.sepia != sepia.checked()) {
|
if(config::snes.sepia != sepia.checked()) {
|
||||||
config::snes.sepia = sepia.checked();
|
config::snes.sepia = sepia.checked();
|
||||||
snes.update_color_lookup_table();
|
snes.update_color_lookup_table();
|
||||||
}
|
}
|
||||||
} else if(param == &grayscale) {
|
} else if(control == &grayscale) {
|
||||||
if(config::snes.grayscale != grayscale.checked()) {
|
if(config::snes.grayscale != grayscale.checked()) {
|
||||||
config::snes.grayscale = grayscale.checked();
|
config::snes.grayscale = grayscale.checked();
|
||||||
snes.update_color_lookup_table();
|
snes.update_color_lookup_table();
|
||||||
}
|
}
|
||||||
} else if(param == &invert) {
|
} else if(control == &invert) {
|
||||||
if(config::snes.invert != invert.checked()) {
|
if(config::snes.invert != invert.checked()) {
|
||||||
config::snes.invert = invert.checked();
|
config::snes.invert = invert.checked();
|
||||||
snes.update_color_lookup_table();
|
snes.update_color_lookup_table();
|
||||||
}
|
}
|
||||||
} else if(param == &preset_optimal) {
|
} else if(control == &preset_optimal) {
|
||||||
config::snes.contrast = 0;
|
config::snes.contrast = 0;
|
||||||
config::snes.brightness = 0;
|
config::snes.brightness = 0;
|
||||||
config::snes.gamma = 80;
|
config::snes.gamma = 80;
|
||||||
|
@ -52,7 +53,7 @@ int RasterSettingsWindow::message(uint id, void *param) {
|
||||||
config::snes.grayscale = false;
|
config::snes.grayscale = false;
|
||||||
config::snes.invert = false;
|
config::snes.invert = false;
|
||||||
sync_ui();
|
sync_ui();
|
||||||
} else if(param == &preset_standard) {
|
} else if(control == &preset_standard) {
|
||||||
config::snes.contrast = 0;
|
config::snes.contrast = 0;
|
||||||
config::snes.brightness = 0;
|
config::snes.brightness = 0;
|
||||||
config::snes.gamma = 100;
|
config::snes.gamma = 100;
|
||||||
|
@ -62,10 +63,10 @@ int RasterSettingsWindow::message(uint id, void *param) {
|
||||||
config::snes.invert = false;
|
config::snes.invert = false;
|
||||||
sync_ui();
|
sync_ui();
|
||||||
}
|
}
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//update all UI controls to match config file values ...
|
//update all UI controls to match config file values ...
|
||||||
|
|
|
@ -14,7 +14,7 @@ ui::Checkbox invert;
|
||||||
ui::Button preset_optimal;
|
ui::Button preset_optimal;
|
||||||
ui::Button preset_standard;
|
ui::Button preset_standard;
|
||||||
|
|
||||||
int message(uint id, void *param);
|
bool message(uint id, uintptr_t param);
|
||||||
void setup();
|
void setup();
|
||||||
void sync_ui();
|
void sync_ui();
|
||||||
} window_raster_settings;
|
} window_raster_settings;
|
||||||
|
|
|
@ -3,7 +3,7 @@ void SettingsWindow::setup() {
|
||||||
panel_list.create(*this, 0, 5, 5, 150, 355);
|
panel_list.create(*this, 0, 5, 5, 150, 355);
|
||||||
panel_list.add_item("Raster Settings");
|
panel_list.add_item("Raster Settings");
|
||||||
panel_list.add_item("Input Configuration");
|
panel_list.add_item("Input Configuration");
|
||||||
//panel_list.add_item("Cheat Code Editor");
|
panel_list.add_item("Cheat Code Editor");
|
||||||
panel_list.add_item("Advanced");
|
panel_list.add_item("Advanced");
|
||||||
panel.create(*this, 0, 160, 5, 475, 355);
|
panel.create(*this, 0, 160, 5, 475, 355);
|
||||||
|
|
||||||
|
@ -15,22 +15,22 @@ void SettingsWindow::show() {
|
||||||
panel_list.focus();
|
panel_list.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
int SettingsWindow::message(uint id, void *param) {
|
bool SettingsWindow::message(uint id, uintptr_t param) {
|
||||||
if(id == ui::Message::Close) {
|
if(id == ui::Message::Close) {
|
||||||
hide();
|
hide();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(id == ui::Message::Changed && param == &panel_list) {
|
if(id == ui::Message::Changed && (ui::Control*)param == &panel_list) {
|
||||||
switch(panel_list.get_selection()) {
|
switch(panel_list.get_selection()) {
|
||||||
case 0: panel.attach(window_raster_settings); break;
|
case 0: panel.attach(window_raster_settings); break;
|
||||||
case 1: panel.attach(window_input_config); break;
|
case 1: panel.attach(window_input_config); break;
|
||||||
//case 2: panel.attach(window_cheat_editor); break;
|
case 2: panel.attach(window_cheat_editor); break;
|
||||||
case 2: panel.attach(window_advanced); break;
|
case 3: panel.attach(window_advanced); break;
|
||||||
}
|
}
|
||||||
panel_list.focus();
|
panel_list.focus();
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
class SettingsWindow : public ui::Window { public:
|
class SettingsWindow : public ui::Window { public:
|
||||||
ui::Listbox panel_list;
|
ui::Listbox panel_list;
|
||||||
ui::Panel panel;
|
ui::Panel panel;
|
||||||
int message(uint id, void *param);
|
bool message(uint id, uintptr_t param = 0);
|
||||||
void show();
|
void show();
|
||||||
void setup();
|
void setup();
|
||||||
} window_settings;
|
} window_settings;
|
||||||
|
|
|
@ -13,11 +13,11 @@ void AboutWindow::setup() {
|
||||||
about.create(*this, 0, 5, 5, 290, 120, about_text);
|
about.create(*this, 0, 5, 5, 290, 120, about_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AboutWindow::message(uint id, void *param) {
|
bool AboutWindow::message(uint id, uintptr_t param) {
|
||||||
if(id == ui::Message::Close) {
|
if(id == ui::Message::Close) {
|
||||||
hide();
|
hide();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
class AboutWindow : public ui::Window { public:
|
class AboutWindow : public ui::Window { public:
|
||||||
ui::Label about;
|
ui::Label about;
|
||||||
static const char about_text[4096];
|
static const char about_text[4096];
|
||||||
int message(uint id, void *param);
|
bool message(uint id, uintptr_t param);
|
||||||
void setup();
|
void setup();
|
||||||
} window_about;
|
} window_about;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
int MainWindow::message(uint id, void *param) {
|
bool MainWindow::message(uint id, uintptr_t param) {
|
||||||
|
ui::Control *control = (ui::Control*)param;
|
||||||
if(id == ui::Message::Close) {
|
if(id == ui::Message::Close) {
|
||||||
_term_ = true;
|
_term_ = true;
|
||||||
hide();
|
hide();
|
||||||
|
@ -7,100 +8,101 @@ int MainWindow::message(uint id, void *param) {
|
||||||
|
|
||||||
if(id == ui::Message::Block) {
|
if(id == ui::Message::Block) {
|
||||||
if(uiAudio) { uiAudio->clear_audio(); }
|
if(uiAudio) { uiAudio->clear_audio(); }
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(id == ui::Message::KeyDown) {
|
if(id == ui::Message::KeyDown) {
|
||||||
if(uiInput) { uiInput->signal_key_down((int)param); }
|
if(uiInput) { uiInput->signal_key_down(param); }
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(id == ui::Message::KeyUp) {
|
if(id == ui::Message::KeyUp) {
|
||||||
if(uiInput) { uiInput->signal_key_up((int)param); }
|
if(uiInput) { uiInput->signal_key_up(param); }
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(id == ui::Message::Clicked) {
|
if(id == ui::Message::Clicked) {
|
||||||
if(param == &menu_file_load) {
|
if(control == &menu_file_load) {
|
||||||
event::load_rom();
|
event::load_rom();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(param == &menu_file_unload) {
|
if(control == &menu_file_unload) {
|
||||||
event::unload_rom();
|
event::unload_rom();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(param == &menu_file_reset) {
|
if(control == &menu_file_reset) {
|
||||||
event::reset();
|
event::reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(param == &menu_file_power) {
|
if(control == &menu_file_power) {
|
||||||
event::power();
|
event::power();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(param == &menu_file_exit) {
|
if(control == &menu_file_exit) {
|
||||||
message(ui::Message::Close);
|
message(ui::Message::Close);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(param == &menu_settings_videomode_1x) { config::video.multiplier = 1; event::update_video_settings(); }
|
if(control == &menu_settings_videomode_1x) { config::video.multiplier = 1; event::update_video_settings(); }
|
||||||
if(param == &menu_settings_videomode_2x) { config::video.multiplier = 2; event::update_video_settings(); }
|
if(control == &menu_settings_videomode_2x) { config::video.multiplier = 2; event::update_video_settings(); }
|
||||||
if(param == &menu_settings_videomode_3x) { config::video.multiplier = 3; event::update_video_settings(); }
|
if(control == &menu_settings_videomode_3x) { config::video.multiplier = 3; event::update_video_settings(); }
|
||||||
if(param == &menu_settings_videomode_4x) { config::video.multiplier = 4; event::update_video_settings(); }
|
if(control == &menu_settings_videomode_4x) { config::video.multiplier = 4; event::update_video_settings(); }
|
||||||
if(param == &menu_settings_videomode_5x) { config::video.multiplier = 5; event::update_video_settings(); }
|
if(control == &menu_settings_videomode_5x) { config::video.multiplier = 5; event::update_video_settings(); }
|
||||||
|
|
||||||
if(param == &menu_settings_videomode_aspect_correction) {
|
if(control == &menu_settings_videomode_aspect_correction) {
|
||||||
config::video.aspect_correction = menu_settings_videomode_aspect_correction.checked();
|
config::video.aspect_correction = menu_settings_videomode_aspect_correction.checked();
|
||||||
event::update_video_settings();
|
event::update_video_settings();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(param == &menu_settings_videomode_ntsc) { config::video.region = 0; event::update_raster_settings(); event::update_video_settings(); }
|
if(control == &menu_settings_videomode_ntsc) { config::video.region = 0; event::update_raster_settings(); event::update_video_settings(); }
|
||||||
if(param == &menu_settings_videomode_pal) { config::video.region = 1; event::update_raster_settings(); event::update_video_settings(); }
|
if(control == &menu_settings_videomode_pal) { config::video.region = 1; event::update_raster_settings(); event::update_video_settings(); }
|
||||||
|
|
||||||
if(param == &menu_settings_videofilter_hwpoint) { config::video.hardware_filter = 0; uiVideo->update_hardware_filter(); }
|
if(control == &menu_settings_videofilter_hwpoint) { config::video.hardware_filter = 0; uiVideo->update_hardware_filter(); }
|
||||||
if(param == &menu_settings_videofilter_hwlinear) { config::video.hardware_filter = 1; uiVideo->update_hardware_filter(); }
|
if(control == &menu_settings_videofilter_hwlinear) { config::video.hardware_filter = 1; uiVideo->update_hardware_filter(); }
|
||||||
|
|
||||||
if(param == &menu_settings_videofilter_swnone) { config::video.software_filter = 0; event::update_raster_settings(); }
|
if(control == &menu_settings_videofilter_swnone) { config::video.software_filter = 0; event::update_raster_settings(); }
|
||||||
if(param == &menu_settings_videofilter_swntsc) { config::video.software_filter = 1; event::update_raster_settings(); }
|
if(control == &menu_settings_videofilter_swntsc) { config::video.software_filter = 1; event::update_raster_settings(); }
|
||||||
if(param == &menu_settings_videofilter_swhq2x) { config::video.software_filter = 2; event::update_raster_settings(); }
|
if(control == &menu_settings_videofilter_swhq2x) { config::video.software_filter = 2; event::update_raster_settings(); }
|
||||||
if(param == &menu_settings_videofilter_swscale2x) { config::video.software_filter = 3; event::update_raster_settings(); }
|
if(control == &menu_settings_videofilter_swscale2x) { config::video.software_filter = 3; event::update_raster_settings(); }
|
||||||
|
|
||||||
if(param == &menu_settings_videoframeskip_0) { config::video.frameskip = 0; }
|
if(control == &menu_settings_videoframeskip_0) { config::video.frameskip = 0; }
|
||||||
if(param == &menu_settings_videoframeskip_1) { config::video.frameskip = 1; }
|
if(control == &menu_settings_videoframeskip_1) { config::video.frameskip = 1; }
|
||||||
if(param == &menu_settings_videoframeskip_2) { config::video.frameskip = 2; }
|
if(control == &menu_settings_videoframeskip_2) { config::video.frameskip = 2; }
|
||||||
if(param == &menu_settings_videoframeskip_3) { config::video.frameskip = 3; }
|
if(control == &menu_settings_videoframeskip_3) { config::video.frameskip = 3; }
|
||||||
if(param == &menu_settings_videoframeskip_4) { config::video.frameskip = 4; }
|
if(control == &menu_settings_videoframeskip_4) { config::video.frameskip = 4; }
|
||||||
if(param == &menu_settings_videoframeskip_5) { config::video.frameskip = 5; }
|
if(control == &menu_settings_videoframeskip_5) { config::video.frameskip = 5; }
|
||||||
if(param == &menu_settings_videoframeskip_6) { config::video.frameskip = 6; }
|
if(control == &menu_settings_videoframeskip_6) { config::video.frameskip = 6; }
|
||||||
if(param == &menu_settings_videoframeskip_7) { config::video.frameskip = 7; }
|
if(control == &menu_settings_videoframeskip_7) { config::video.frameskip = 7; }
|
||||||
if(param == &menu_settings_videoframeskip_8) { config::video.frameskip = 8; }
|
if(control == &menu_settings_videoframeskip_8) { config::video.frameskip = 8; }
|
||||||
if(param == &menu_settings_videoframeskip_9) { config::video.frameskip = 9; }
|
if(control == &menu_settings_videoframeskip_9) { config::video.frameskip = 9; }
|
||||||
|
|
||||||
if(param == &menu_settings_mute) {
|
if(control == &menu_settings_mute) {
|
||||||
config::snes.mute = menu_settings_mute.checked();
|
config::snes.mute = menu_settings_mute.checked();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(param == &menu_settings_speedreg_enable) {
|
if(control == &menu_settings_speedreg_enable) {
|
||||||
config::system.regulate_speed = menu_settings_speedreg_enable.checked();
|
config::system.regulate_speed = menu_settings_speedreg_enable.checked();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(param == &menu_settings_speedreg_slowest) { config::system.speed = 1; uiAudio->update_frequency(); }
|
if(control == &menu_settings_speedreg_slowest) { config::system.speed = 1; uiAudio->update_frequency(); }
|
||||||
if(param == &menu_settings_speedreg_slow) { config::system.speed = 2; uiAudio->update_frequency(); }
|
if(control == &menu_settings_speedreg_slow) { config::system.speed = 2; uiAudio->update_frequency(); }
|
||||||
if(param == &menu_settings_speedreg_normal) { config::system.speed = 3; uiAudio->update_frequency(); }
|
if(control == &menu_settings_speedreg_normal) { config::system.speed = 3; uiAudio->update_frequency(); }
|
||||||
if(param == &menu_settings_speedreg_fast) { config::system.speed = 4; uiAudio->update_frequency(); }
|
if(control == &menu_settings_speedreg_fast) { config::system.speed = 4; uiAudio->update_frequency(); }
|
||||||
if(param == &menu_settings_speedreg_fastest) { config::system.speed = 5; uiAudio->update_frequency(); }
|
if(control == &menu_settings_speedreg_fastest) { config::system.speed = 5; uiAudio->update_frequency(); }
|
||||||
|
|
||||||
if(param == &menu_settings_config) { window_settings.show(); }
|
if(control == &menu_settings_config) { window_settings.show(); }
|
||||||
|
|
||||||
if(param == &menu_misc_logaudio) {
|
if(control == &menu_misc_logaudio) {
|
||||||
(menu_misc_logaudio.checked() == true) ? snes.log_audio_enable() : snes.log_audio_disable();
|
(menu_misc_logaudio.checked() == true) ? snes.log_audio_enable() : snes.log_audio_disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(param == &menu_misc_about) {
|
if(control == &menu_misc_about) {
|
||||||
window_about.focus();
|
window_about.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setup() {
|
void MainWindow::setup() {
|
||||||
|
|
|
@ -60,7 +60,7 @@ ui::MenuGroup menu_misc;
|
||||||
ui::Container view;
|
ui::Container view;
|
||||||
//
|
//
|
||||||
|
|
||||||
int message(uint id, void *param = 0);
|
bool message(uint id, uintptr_t param = 0);
|
||||||
void setup();
|
void setup();
|
||||||
void setup_menu();
|
void setup_menu();
|
||||||
} window_main;
|
} window_main;
|
||||||
|
|
Loading…
Reference in New Issue