~ubuntu-branches/ubuntu/maverick/vice/maverick

« back to all changes in this revision

Viewing changes to src/keyboard.c

  • Committer: Bazaar Package Importer
  • Author(s): Zed Pobre
  • Date: 2005-02-01 11:30:26 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20050201113026-3eyakzsmmheclvjg
Tags: 1.16-1
* New upstream version
* Fixes crash on 64-bit architectures (closes: #287640)
* x128 working again (closes: #286767)
* Works fine with /dev/dsp in use (not in the main changelog, but tested
  on my local machine as working).  Presumably, this also takes care of
  the issue with dsp being held.  I'm not sure if this is because I'm
  testing it on a 2.6 kernel now -- if you are still having problems
  with /dev/dsp, please reopen the bugs. (closes: #152952, #207942)
* Don't kill Makefile.in on clean

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
#include "machine.h"
48
48
#include "maincpu.h"
49
49
#include "resources.h"
 
50
#include "snapshot.h"
50
51
#include "sysfile.h"
51
52
#include "types.h"
52
53
#include "util.h"
369
370
                                             keyconvmap[i].column,
370
371
                                             keyconvmap[i].shift)) {
371
372
                latch = 1;
 
373
                keyboard_set_latch_keyarr(keyconvmap[i].row,
 
374
                                          keyconvmap[i].column, 0);
372
375
                if (!(keyconvmap[i].shift & ALLOW_OTHER)
373
 
                    || (right_shift_down + left_shift_down) == 0)
 
376
                    /*|| (right_shift_down + left_shift_down) == 0*/)
374
377
                    break;
375
378
            }
376
379
        }
377
380
    }
378
381
 
379
382
    if (latch) {
380
 
        keyboard_set_latch_keyarr(key_latch_row, key_latch_column, 0);
 
383
        /*keyboard_set_latch_keyarr(key_latch_row, key_latch_column, 0);*/
381
384
        alarm_set(keyboard_alarm, maincpu_clk + KEYBOARD_RAND());
382
385
    }
383
386
}
409
412
static void keyboard_keyconvmap_free(void)
410
413
{
411
414
    lib_free(keyconvmap);
 
415
    keyconvmap = NULL;
412
416
}
413
417
 
414
418
static void keyboard_keyconvmap_realloc(void)
538
542
    int i;
539
543
 
540
544
    for (i = 0; keyconvmap[i].sym; i++) {
541
 
        if (sym == keyconvmap[i].sym) {
 
545
        if (sym == keyconvmap[i].sym && !(keyconvmap[i].shift & ALLOW_OTHER)) {
542
546
            keyconvmap[i].row = row;
543
547
            keyconvmap[i].column = col;
544
548
            keyconvmap[i].shift = shift;
716
720
            "# '!UNDEF keysym'        remove keysym from table\n"
717
721
            "#\n"
718
722
            "# Shiftflag can have the values:\n"
719
 
            "# 0      key is not shifted for this keysym\n"
720
 
            "# 1      key is shifted for this keysym\n"
 
723
            "# 0      key is not shifted for this keysym/scancode\n"
 
724
            "# 1      key is shifted for this keysym/scancode\n"
721
725
            "# 2      left shift\n"
722
726
            "# 4      right shift\n"
723
 
            "# 8      key can be shifted or not with this keysym\n"
 
727
            "# 8      key can be shifted or not with this keysym/scancode\n"
 
728
            "# 16     deshift key for this keysym/scancode\n"
 
729
            "# 32     another definition for this keysym/scancode follows\n"
724
730
            "#\n"
725
731
            "# Negative row values:\n"
726
732
            "# 'keysym -1 n' joystick #1, direction n\n"
903
909
#endif
904
910
}
905
911
 
 
912
/*--------------------------------------------------------------------------*/
 
913
int keyboard_snapshot_write_module(snapshot_t *s)
 
914
{
 
915
    snapshot_module_t *m;
 
916
 
 
917
    m = snapshot_module_create(s, "KEYBOARD", 1, 0);
 
918
    if (m == NULL)
 
919
       return -1;
 
920
 
 
921
    if (0
 
922
        || SMW_DWA(m, (DWORD *)keyarr, KBD_ROWS) < 0
 
923
        || SMW_DWA(m, (DWORD *)rev_keyarr, KBD_COLS) < 0)
 
924
    {
 
925
        snapshot_module_close(m);
 
926
        return -1;
 
927
    }
 
928
 
 
929
    if (snapshot_module_close(m) < 0)
 
930
        return -1;
 
931
 
 
932
    return 0;
 
933
}
 
934
 
 
935
int keyboard_snapshot_read_module(snapshot_t *s)
 
936
{
 
937
    BYTE major_version, minor_version;
 
938
    snapshot_module_t *m;
 
939
 
 
940
    m = snapshot_module_open(s, "KEYBOARD",
 
941
                             &major_version, &minor_version);
 
942
    if (m == NULL) {
 
943
        return 0;
 
944
    }
 
945
 
 
946
    if (0
 
947
        || SMR_DWA(m, (DWORD *)keyarr, KBD_ROWS) < 0
 
948
        || SMR_DWA(m, (DWORD *)rev_keyarr, KBD_COLS) < 0)
 
949
    {
 
950
        snapshot_module_close(m);
 
951
        return -1;
 
952
    }
 
953
 
 
954
    snapshot_module_close(m);
 
955
    return 0;
 
956
}