~ubuntu-branches/ubuntu/trusty/vice/trusty

« back to all changes in this revision

Viewing changes to src/crtc/crtc-resources.c

  • Committer: Package Import Robot
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2013-07-28 20:38:23 UTC
  • mfrom: (1.1.10) (9.2.7 sid)
  • Revision ID: package-import@ubuntu.com-20130728203823-1h8s6bcv22oundul
Tags: 2.4.dfsg-1
* New upstream release (closes: #693065, #693641).
* Drop vice-ffmpeg.patch , applied upstream.
* Disable architecture specific compilation (closes: #686400, #714136).

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
 *
27
27
 */
28
28
 
 
29
/* #define DEBUG_CRTC */
 
30
 
 
31
#ifdef DEBUG_CRTC
 
32
#define DBG(_x_)        log_debug _x_
 
33
#else
 
34
#define DBG(_x_)
 
35
#endif
 
36
 
29
37
#include "vice.h"
30
38
 
31
39
#include <stdio.h>
34
42
#include "crtc-resources.h"
35
43
#include "crtctypes.h"
36
44
#include "fullscreen.h"
 
45
#include "log.h"
37
46
#include "raster-resources.h"
 
47
#include "resources.h"
38
48
#include "video.h"
39
49
 
40
50
 
41
51
static video_chip_cap_t video_chip_cap;
42
52
 
 
53
static int crtc_stretchy;
 
54
 
 
55
void crtc_update_renderer(void)
 
56
{
 
57
    DBG(("crtc_update_renderer crtc.hw_cols: %d", crtc.screen_width));
 
58
 
 
59
    if ((crtc_stretchy) && (crtc.screen_width > ((384 + 704) / 2))) {
 
60
        /* 80 columns */
 
61
        crtc.video_chip_cap->single_mode.sizex = 1;
 
62
        crtc.video_chip_cap->single_mode.sizey = 2;
 
63
        crtc.video_chip_cap->single_mode.rmode = VIDEO_RENDER_CRT_1X2;
 
64
        crtc.video_chip_cap->double_mode.sizex = 2;
 
65
        crtc.video_chip_cap->double_mode.sizey = 4;
 
66
        crtc.video_chip_cap->double_mode.rmode = VIDEO_RENDER_CRT_2X4;
 
67
    } else {
 
68
        /* 40 columns */
 
69
        crtc.video_chip_cap->single_mode.sizex = 1;
 
70
        crtc.video_chip_cap->single_mode.sizey = 1;
 
71
        crtc.video_chip_cap->single_mode.rmode = VIDEO_RENDER_CRT_1X1;
 
72
        crtc.video_chip_cap->double_mode.sizex = 2;
 
73
        crtc.video_chip_cap->double_mode.sizey = 2;
 
74
        crtc.video_chip_cap->double_mode.rmode = VIDEO_RENDER_CRT_2X2;
 
75
    }
 
76
}
 
77
 
 
78
static int set_stretch(int val, void *param)
 
79
{
 
80
    DBG(("set_stretch"));
 
81
    crtc_stretchy = val;
 
82
    crtc_update_renderer();
 
83
    resources_touch("CrtcDoubleSize");
 
84
    return 0;
 
85
}
 
86
 
 
87
static const resource_int_t resources_int[] =
 
88
{
 
89
    { "CrtcStretchVertical", 1, RES_EVENT_SAME, NULL,
 
90
      &crtc_stretchy, set_stretch, NULL },
 
91
    { NULL, 0, 0, NULL,
 
92
      NULL, NULL, NULL }
 
93
};
43
94
 
44
95
int crtc_resources_init(void)
45
96
{
46
97
    video_chip_cap.dsize_allowed = ARCHDEP_CRTC_DSIZE;
47
98
    video_chip_cap.dsize_default = 0;
48
 
    video_chip_cap.dsize_limit_width = 400;
49
 
    video_chip_cap.dsize_limit_height = 350;
 
99
    video_chip_cap.dsize_limit_width = 800; /* 2 times the 80cols screen */
 
100
    video_chip_cap.dsize_limit_height = 700; /* 4 times the 80cols screen */
50
101
    video_chip_cap.dscan_allowed = ARCHDEP_CRTC_DSCAN;
51
102
    video_chip_cap.hwscale_allowed = ARCHDEP_CRTC_HWSCALE;
52
103
    video_chip_cap.scale2x_allowed = ARCHDEP_CRTC_DSIZE;
54
105
    video_chip_cap.external_palette_name = "green";
55
106
    video_chip_cap.palemulation_allowed = 1;
56
107
    video_chip_cap.double_buffering_allowed = ARCHDEP_CRTC_DBUF;
57
 
    video_chip_cap.single_mode.sizex = 1;
58
 
    video_chip_cap.single_mode.sizey = 1;
59
 
    video_chip_cap.single_mode.rmode = VIDEO_RENDER_CRT_1X1;
60
 
    /* FIXME: both are equally wrong. some mechanism is needed to
61
 
              dynamically handle 40 vs 80 colums crtc */
62
 
#if 0
63
 
    /* 40 columns */
64
 
    video_chip_cap.double_mode.sizex = 2;
65
 
    video_chip_cap.double_mode.sizey = 2;
66
 
    video_chip_cap.double_mode.rmode = VIDEO_RENDER_CRT_2X2;
67
 
#else
68
 
    /* 80 columns */
69
 
    video_chip_cap.double_mode.sizex = 1;
70
 
    video_chip_cap.double_mode.sizey = 2;
71
 
    video_chip_cap.double_mode.rmode = VIDEO_RENDER_CRT_1X2;
72
 
#endif
73
108
    fullscreen_capability(&(video_chip_cap.fullscreen));
74
109
 
75
110
    if (raster_resources_chip_init("Crtc", &crtc.raster, &video_chip_cap) < 0) {
76
111
        return -1;
77
112
    }
78
113
    crtc.video_chip_cap = &video_chip_cap;
 
114
    crtc_update_renderer();
79
115
 
80
 
    return 0;
 
116
    return resources_register_int(resources_int);
81
117
}
82
118