~ubuntu-branches/ubuntu/utopic/fceux/utopic-proposed

« back to all changes in this revision

Viewing changes to src/input.cpp

  • Committer: Package Import Robot
  • Author(s): Joe Nahmias
  • Date: 2014-03-02 19:22:04 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140302192204-9f0aehi5stfnhn7d
Tags: 2.2.2+dfsg0-1
* Imported Upstream version 2.2.2
  + remove patches merged upstream; refresh remaining
  + remove windows compiled help files and non-free Visual C files
* Use C++11 standard static assertion functionality
* fix upstream installation of support files
* New patch 0004-ignore-missing-windows-help-CHM-file.patch
* update d/copyright for new, renamed, deleted files
* d/control: bump std-ver to 3.9.5, no changes needed

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
20
*/
21
21
 
22
 
#include <string>
23
 
#include <ostream>
24
 
#include <string.h>
25
 
 
26
22
#include "types.h"
27
23
#include "x6502.h"
28
24
 
52
48
#include "drivers/win/window.h"
53
49
#include "drivers/win/ntview.h"
54
50
#include "drivers/win/taseditor.h"
 
51
 
 
52
#include <string>
 
53
#include <ostream>
 
54
#include <cstring>
 
55
 
55
56
extern bool mustRewindNow;
56
57
#endif // WIN32
57
58
 
169
170
}
170
171
 
171
172
//a main joystick port driver representing the case where nothing is plugged in
172
 
static INPUTC DummyJPort={0,0,0,0,0,0};
 
173
static INPUTC DummyJPort={0};
173
174
//and an expansion port driver for the same ting
174
 
static INPUTCFC DummyPortFC={0,0,0,0,0,0};
 
175
static INPUTCFC DummyPortFC={0};
175
176
 
176
177
 
177
178
//--------4 player driver for expansion port--------
299
300
        joy_readbit[w]=0;
300
301
}
301
302
 
302
 
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^6
 
303
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
303
304
 
304
305
 
305
306
static INPUTC GPC={ReadGP,0,StrobeGP,UpdateGP,0,0,LogGP,LoadGP};
319
320
        //tell all drivers to poll input and set up their logical states
320
321
        if(!FCEUMOV_Mode(MOVIEMODE_PLAY))
321
322
        {
322
 
                for(int port=0;port<2;port++)
 
323
                for(int port=0;port<2;port++){
323
324
                        joyports[port].driver->Update(port,joyports[port].ptr,joyports[port].attrib);
 
325
        }
324
326
                portFC.driver->Update(portFC.ptr,portFC.attrib);
325
327
        }
326
328
 
333
335
        FCEUMOV_AddInputState();
334
336
 
335
337
        //TODO - should this apply to the movie data? should this be displayed in the input hud?
336
 
        if(GameInfo->type==GIT_VSUNI)
 
338
        if(GameInfo->type==GIT_VSUNI){
337
339
                FCEU_VSUniSwap(&joy[0],&joy[1]);
 
340
    }
338
341
}
339
342
 
340
343
static DECLFR(VSUNIRead0)
371
374
        portFC.driver->SLHook(bg,spr,linets,final);
372
375
}
373
376
 
 
377
#include <iostream>
374
378
//binds JPorts[pad] to the driver specified in JPType[pad]
375
379
static void SetInputStuff(int port)
376
380
{
377
381
        switch(joyports[port].type)
378
382
        {
379
383
        case SI_GAMEPAD:
380
 
                if(GameInfo->type==GIT_VSUNI)
 
384
                if(GameInfo->type==GIT_VSUNI){
381
385
                        joyports[port].driver = &GPCVS;
382
 
                else
 
386
        } else {
383
387
                        joyports[port].driver= &GPC;
 
388
        }
384
389
                break;
385
390
        case SI_ARKANOID:
386
391
                joyports[port].driver=FCEU_InitArkanoid(port);
576
581
 
577
582
void FCEUI_VSUniCoin(void)
578
583
{
 
584
        if(!FCEU_IsValidUI(FCEUI_INSERT_COIN))
 
585
                return;
 
586
 
579
587
        FCEU_QSimpleCommand(FCEUNPCMD_VSUNICOIN);
580
588
}
581
589
 
743
751
        { EMUCMD_FDS_EJECT_INSERT,                              EMUCMDTYPE_FDS,         FCEUI_FDSInsert, 0, 0, "Eject or Insert FDS Disk", EMUCMDFLAG_TASEDITOR },
744
752
        { EMUCMD_FDS_SIDE_SELECT,                               EMUCMDTYPE_FDS,         FCEUI_FDSSelect, 0, 0, "Switch FDS Disk Side", EMUCMDFLAG_TASEDITOR },
745
753
 
746
 
        { EMUCMD_VSUNI_COIN,                                    EMUCMDTYPE_VSUNI,       FCEUI_VSUniCoin, 0, 0, "Insert Coin", 0 },
 
754
        { EMUCMD_VSUNI_COIN,                                    EMUCMDTYPE_VSUNI,       FCEUI_VSUniCoin, 0, 0, "Insert Coin", EMUCMDFLAG_TASEDITOR },
747
755
        { EMUCMD_VSUNI_TOGGLE_DIP_0,                    EMUCMDTYPE_VSUNI,       CommandToggleDip, 0, 0, "Toggle Dipswitch 0", 0 },
748
756
        { EMUCMD_VSUNI_TOGGLE_DIP_1,                    EMUCMDTYPE_VSUNI,       CommandToggleDip, 0, 0, "Toggle Dipswitch 1", 0 },
749
757
        { EMUCMD_VSUNI_TOGGLE_DIP_2,                    EMUCMDTYPE_VSUNI,       CommandToggleDip, 0, 0, "Toggle Dipswitch 2", 0 },
754
762
        { EMUCMD_VSUNI_TOGGLE_DIP_7,                    EMUCMDTYPE_VSUNI,       CommandToggleDip, 0, 0, "Toggle Dipswitch 7", 0 },
755
763
        { EMUCMD_VSUNI_TOGGLE_DIP_8,                    EMUCMDTYPE_VSUNI,       CommandToggleDip, 0, 0, "Toggle Dipswitch 8", 0 },
756
764
        { EMUCMD_VSUNI_TOGGLE_DIP_9,                    EMUCMDTYPE_VSUNI,       CommandToggleDip, 0, 0, "Toggle Dipswitch 9", 0 },
757
 
        { EMUCMD_MISC_AUTOSAVE,                                 EMUCMDTYPE_MISC,        FCEUI_Autosave,   0, 0, "Load Last Auto-save", 0},
 
765
        { EMUCMD_MISC_AUTOSAVE,                                 EMUCMDTYPE_MISC,        FCEUI_RewindToLastAutosave,   0, 0, "Load Last Auto-save", 0},
758
766
        { EMUCMD_MISC_SHOWSTATES,                               EMUCMDTYPE_MISC,        ViewSlots,        0, 0, "View save slots",    0 },
759
767
        { EMUCMD_MISC_USE_INPUT_PRESET_1,               EMUCMDTYPE_MISC,        CommandUsePreset, 0, 0, "Use Input Preset 1", EMUCMDFLAG_TASEDITOR },
760
768
        { EMUCMD_MISC_USE_INPUT_PRESET_2,               EMUCMDTYPE_MISC,        CommandUsePreset, 0, 0, "Use Input Preset 2", EMUCMDFLAG_TASEDITOR },
1150
1158
 
1151
1159
static void UndoRedoSavestate(void)
1152
1160
{
 
1161
        // FIXME this will always evaluate to true, should this be
 
1162
        // if (*lastSavestateMade...) to check if it holds a string or just
 
1163
        // a '\0'?
1153
1164
        if (lastSavestateMade && (undoSS || redoSS))
1154
1165
                SwapSaveState();
1155
1166
}