trunk/src/mame/drivers/flyball.c
| r244656 | r244657 | |
| 28 | 28 | public: |
| 29 | 29 | enum |
| 30 | 30 | { |
| 31 | | TIMER_POT_ASSERT, |
| 32 | | TIMER_POT_CLEAR, |
| 33 | | TIMER_QUARTER |
| 31 | TIMER_FLYBALL_POT_ASSERT, |
| 32 | TIMER_FLYBALL_POT_CLEAR, |
| 33 | TIMER_FLYBALL_QUARTER |
| 34 | 34 | }; |
| 35 | 35 | |
| 36 | 36 | flyball_state(const machine_config &mconfig, device_type type, const char *tag) |
| 37 | 37 | : driver_device(mconfig, type, tag), |
| 38 | m_playfield_ram(*this, "playfield_ram"), |
| 38 | 39 | m_maincpu(*this, "maincpu"), |
| 39 | 40 | m_gfxdecode(*this, "gfxdecode"), |
| 40 | 41 | m_screen(*this, "screen"), |
| 41 | | m_palette(*this, "palette"), |
| 42 | | m_playfield_ram(*this, "playfield_ram") { } |
| 42 | m_palette(*this, "palette") { } |
| 43 | 43 | |
| 44 | | /* devices */ |
| 45 | | required_device<cpu_device> m_maincpu; |
| 46 | | required_device<gfxdecode_device> m_gfxdecode; |
| 47 | | required_device<screen_device> m_screen; |
| 48 | | required_device<palette_device> m_palette; |
| 49 | | |
| 50 | 44 | /* memory pointers */ |
| 51 | 45 | required_shared_ptr<UINT8> m_playfield_ram; |
| 52 | 46 | |
| r244656 | r244657 | |
| 61 | 55 | /* misc */ |
| 62 | 56 | UINT8 m_potmask; |
| 63 | 57 | UINT8 m_potsense; |
| 64 | | |
| 65 | | emu_timer *m_pot_clear_timer; |
| 66 | | emu_timer *m_quarter_timer; |
| 67 | | |
| 68 | | DECLARE_READ8_MEMBER(input_r); |
| 69 | | DECLARE_READ8_MEMBER(scanline_r); |
| 70 | | DECLARE_READ8_MEMBER(potsense_r); |
| 71 | | DECLARE_WRITE8_MEMBER(potmask_w); |
| 72 | | DECLARE_WRITE8_MEMBER(pitcher_pic_w); |
| 73 | | DECLARE_WRITE8_MEMBER(ball_vert_w); |
| 74 | | DECLARE_WRITE8_MEMBER(ball_horz_w); |
| 75 | | DECLARE_WRITE8_MEMBER(pitcher_vert_w); |
| 76 | | DECLARE_WRITE8_MEMBER(pitcher_horz_w); |
| 77 | | DECLARE_WRITE8_MEMBER(misc_w); |
| 78 | | |
| 79 | | TILEMAP_MAPPER_MEMBER(get_memory_offset); |
| 80 | | TILE_GET_INFO_MEMBER(get_tile_info); |
| 81 | | |
| 58 | |
| 59 | /* devices */ |
| 60 | required_device<cpu_device> m_maincpu; |
| 61 | required_device<gfxdecode_device> m_gfxdecode; |
| 62 | required_device<screen_device> m_screen; |
| 63 | required_device<palette_device> m_palette; |
| 64 | |
| 65 | DECLARE_READ8_MEMBER(flyball_input_r); |
| 66 | DECLARE_READ8_MEMBER(flyball_scanline_r); |
| 67 | DECLARE_READ8_MEMBER(flyball_potsense_r); |
| 68 | DECLARE_WRITE8_MEMBER(flyball_potmask_w); |
| 69 | DECLARE_WRITE8_MEMBER(flyball_pitcher_pic_w); |
| 70 | DECLARE_WRITE8_MEMBER(flyball_ball_vert_w); |
| 71 | DECLARE_WRITE8_MEMBER(flyball_ball_horz_w); |
| 72 | DECLARE_WRITE8_MEMBER(flyball_pitcher_vert_w); |
| 73 | DECLARE_WRITE8_MEMBER(flyball_pitcher_horz_w); |
| 74 | DECLARE_WRITE8_MEMBER(flyball_misc_w); |
| 75 | TILEMAP_MAPPER_MEMBER(flyball_get_memory_offset); |
| 76 | TILE_GET_INFO_MEMBER(flyball_get_tile_info); |
| 82 | 77 | virtual void machine_start(); |
| 83 | 78 | virtual void machine_reset(); |
| 84 | 79 | virtual void video_start(); |
| 85 | 80 | DECLARE_PALETTE_INIT(flyball); |
| 86 | | |
| 87 | | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 88 | | |
| 89 | | TIMER_CALLBACK_MEMBER(joystick_callback); |
| 90 | | TIMER_CALLBACK_MEMBER(quarter_callback); |
| 81 | UINT32 screen_update_flyball(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 82 | TIMER_CALLBACK_MEMBER(flyball_joystick_callback); |
| 83 | TIMER_CALLBACK_MEMBER(flyball_quarter_callback); |
| 91 | 84 | |
| 92 | 85 | protected: |
| 93 | 86 | virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); |
| r244656 | r244657 | |
| 100 | 93 | * |
| 101 | 94 | *************************************/ |
| 102 | 95 | |
| 103 | | TILEMAP_MAPPER_MEMBER(flyball_state::get_memory_offset) |
| 96 | TILEMAP_MAPPER_MEMBER(flyball_state::flyball_get_memory_offset) |
| 104 | 97 | { |
| 105 | 98 | if (col == 0) |
| 106 | 99 | col = num_cols; |
| r244656 | r244657 | |
| 109 | 102 | } |
| 110 | 103 | |
| 111 | 104 | |
| 112 | | TILE_GET_INFO_MEMBER(flyball_state::get_tile_info) |
| 105 | TILE_GET_INFO_MEMBER(flyball_state::flyball_get_tile_info) |
| 113 | 106 | { |
| 114 | 107 | UINT8 data = m_playfield_ram[tile_index]; |
| 115 | 108 | int flags = ((data & 0x40) ? TILE_FLIPX : 0) | ((data & 0x80) ? TILE_FLIPY : 0); |
| r244656 | r244657 | |
| 124 | 117 | |
| 125 | 118 | void flyball_state::video_start() |
| 126 | 119 | { |
| 127 | | m_tmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(flyball_state::get_tile_info),this), tilemap_mapper_delegate(FUNC(flyball_state::get_memory_offset),this), 8, 16, 32, 16); |
| 120 | m_tmap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(flyball_state::flyball_get_tile_info),this), tilemap_mapper_delegate(FUNC(flyball_state::flyball_get_memory_offset),this), 8, 16, 32, 16); |
| 128 | 121 | } |
| 129 | 122 | |
| 130 | 123 | |
| 131 | | UINT32 flyball_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 124 | UINT32 flyball_state::screen_update_flyball(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 132 | 125 | { |
| 133 | 126 | int pitcherx = m_pitcher_horz; |
| 134 | 127 | int pitchery = m_pitcher_vert - 31; |
| r244656 | r244657 | |
| 158 | 151 | { |
| 159 | 152 | switch (id) |
| 160 | 153 | { |
| 161 | | case TIMER_POT_ASSERT: |
| 162 | | joystick_callback(ptr, param); |
| 154 | case TIMER_FLYBALL_POT_ASSERT: |
| 155 | flyball_joystick_callback(ptr, param); |
| 163 | 156 | break; |
| 164 | | case TIMER_POT_CLEAR: |
| 157 | case TIMER_FLYBALL_POT_CLEAR: |
| 165 | 158 | m_maincpu->set_input_line(0, CLEAR_LINE); |
| 166 | 159 | break; |
| 167 | | case TIMER_QUARTER: |
| 168 | | quarter_callback(ptr, param); |
| 160 | case TIMER_FLYBALL_QUARTER: |
| 161 | flyball_quarter_callback(ptr, param); |
| 169 | 162 | break; |
| 170 | 163 | |
| 171 | 164 | default: |
| r244656 | r244657 | |
| 174 | 167 | } |
| 175 | 168 | |
| 176 | 169 | |
| 177 | | TIMER_CALLBACK_MEMBER(flyball_state::joystick_callback) |
| 170 | TIMER_CALLBACK_MEMBER(flyball_state::flyball_joystick_callback) |
| 178 | 171 | { |
| 179 | 172 | int potsense = param; |
| 180 | 173 | |
| r244656 | r244657 | |
| 182 | 175 | { |
| 183 | 176 | // pot irq is active at hsync |
| 184 | 177 | m_maincpu->set_input_line(0, ASSERT_LINE); |
| 185 | | m_pot_clear_timer->adjust(attotime::from_ticks(32, PIXEL_CLOCK), 0); |
| 178 | timer_set(attotime::from_ticks(32, PIXEL_CLOCK), TIMER_FLYBALL_POT_CLEAR, 0); |
| 186 | 179 | } |
| 187 | 180 | |
| 188 | 181 | m_potsense |= potsense; |
| 189 | 182 | } |
| 190 | 183 | |
| 191 | 184 | |
| 192 | | TIMER_CALLBACK_MEMBER(flyball_state::quarter_callback) |
| 185 | TIMER_CALLBACK_MEMBER(flyball_state::flyball_quarter_callback) |
| 193 | 186 | { |
| 194 | 187 | int scanline = param; |
| 195 | 188 | int potsense[64], i; |
| r244656 | r244657 | |
| 203 | 196 | |
| 204 | 197 | for (i = 0; i < 64; i++) |
| 205 | 198 | if (potsense[i] != 0) |
| 206 | | timer_set(m_screen->time_until_pos(scanline + i), TIMER_POT_ASSERT, potsense[i]); |
| 199 | timer_set(m_screen->time_until_pos(scanline + i), TIMER_FLYBALL_POT_ASSERT, potsense[i]); |
| 207 | 200 | |
| 208 | 201 | scanline += 0x40; |
| 209 | 202 | scanline &= 0xff; |
| 210 | 203 | |
| 211 | | m_quarter_timer->adjust(m_screen->time_until_pos(scanline), scanline); |
| 204 | timer_set(m_screen->time_until_pos(scanline), TIMER_FLYBALL_QUARTER, scanline); |
| 212 | 205 | |
| 213 | 206 | m_potsense = 0; |
| 214 | 207 | m_potmask = 0; |
| r244656 | r244657 | |
| 222 | 215 | *************************************/ |
| 223 | 216 | |
| 224 | 217 | /* two physical buttons (start game and stop runner) share the same port bit */ |
| 225 | | READ8_MEMBER(flyball_state::input_r) |
| 218 | READ8_MEMBER(flyball_state::flyball_input_r) |
| 226 | 219 | { |
| 227 | 220 | return ioport("IN0")->read() & ioport("IN1")->read(); |
| 228 | 221 | } |
| 229 | 222 | |
| 230 | | READ8_MEMBER(flyball_state::scanline_r) |
| 223 | READ8_MEMBER(flyball_state::flyball_scanline_r) |
| 231 | 224 | { |
| 232 | 225 | return m_screen->vpos() & 0x3f; |
| 233 | 226 | } |
| 234 | 227 | |
| 235 | | READ8_MEMBER(flyball_state::potsense_r) |
| 228 | READ8_MEMBER(flyball_state::flyball_potsense_r) |
| 236 | 229 | { |
| 237 | 230 | return m_potsense & ~m_potmask; |
| 238 | 231 | } |
| 239 | 232 | |
| 240 | | WRITE8_MEMBER(flyball_state::potmask_w) |
| 233 | WRITE8_MEMBER(flyball_state::flyball_potmask_w) |
| 241 | 234 | { |
| 242 | 235 | m_potmask |= data & 0xf; |
| 243 | 236 | } |
| 244 | 237 | |
| 245 | | WRITE8_MEMBER(flyball_state::pitcher_pic_w) |
| 238 | WRITE8_MEMBER(flyball_state::flyball_pitcher_pic_w) |
| 246 | 239 | { |
| 247 | 240 | m_pitcher_pic = data & 0xf; |
| 248 | 241 | } |
| 249 | 242 | |
| 250 | | WRITE8_MEMBER(flyball_state::ball_vert_w) |
| 243 | WRITE8_MEMBER(flyball_state::flyball_ball_vert_w) |
| 251 | 244 | { |
| 252 | 245 | m_ball_vert = data; |
| 253 | 246 | } |
| 254 | 247 | |
| 255 | | WRITE8_MEMBER(flyball_state::ball_horz_w) |
| 248 | WRITE8_MEMBER(flyball_state::flyball_ball_horz_w) |
| 256 | 249 | { |
| 257 | 250 | m_ball_horz = data; |
| 258 | 251 | } |
| 259 | 252 | |
| 260 | | WRITE8_MEMBER(flyball_state::pitcher_vert_w) |
| 253 | WRITE8_MEMBER(flyball_state::flyball_pitcher_vert_w) |
| 261 | 254 | { |
| 262 | 255 | m_pitcher_vert = data; |
| 263 | 256 | } |
| 264 | 257 | |
| 265 | | WRITE8_MEMBER(flyball_state::pitcher_horz_w) |
| 258 | WRITE8_MEMBER(flyball_state::flyball_pitcher_horz_w) |
| 266 | 259 | { |
| 267 | 260 | m_pitcher_horz = data; |
| 268 | 261 | } |
| 269 | 262 | |
| 270 | | WRITE8_MEMBER(flyball_state::misc_w) |
| 263 | WRITE8_MEMBER(flyball_state::flyball_misc_w) |
| 271 | 264 | { |
| 272 | 265 | int bit = ~data & 1; |
| 273 | 266 | |
| r244656 | r244657 | |
| 305 | 298 | ADDRESS_MAP_GLOBAL_MASK(0x1fff) |
| 306 | 299 | AM_RANGE(0x0000, 0x00ff) AM_MIRROR(0x100) AM_RAM |
| 307 | 300 | AM_RANGE(0x0800, 0x0800) AM_NOP |
| 308 | | AM_RANGE(0x0801, 0x0801) AM_WRITE(pitcher_pic_w) |
| 309 | | AM_RANGE(0x0802, 0x0802) AM_READ(scanline_r) |
| 310 | | AM_RANGE(0x0803, 0x0803) AM_READ(potsense_r) |
| 311 | | AM_RANGE(0x0804, 0x0804) AM_WRITE(ball_vert_w) |
| 312 | | AM_RANGE(0x0805, 0x0805) AM_WRITE(ball_horz_w) |
| 313 | | AM_RANGE(0x0806, 0x0806) AM_WRITE(pitcher_vert_w) |
| 314 | | AM_RANGE(0x0807, 0x0807) AM_WRITE(pitcher_horz_w) |
| 315 | | AM_RANGE(0x0900, 0x0900) AM_WRITE(potmask_w) |
| 316 | | AM_RANGE(0x0a00, 0x0a07) AM_WRITE(misc_w) |
| 317 | | AM_RANGE(0x0b00, 0x0b00) AM_READ(input_r) |
| 301 | AM_RANGE(0x0801, 0x0801) AM_WRITE(flyball_pitcher_pic_w) |
| 302 | AM_RANGE(0x0802, 0x0802) AM_READ(flyball_scanline_r) |
| 303 | AM_RANGE(0x0803, 0x0803) AM_READ(flyball_potsense_r) |
| 304 | AM_RANGE(0x0804, 0x0804) AM_WRITE(flyball_ball_vert_w) |
| 305 | AM_RANGE(0x0805, 0x0805) AM_WRITE(flyball_ball_horz_w) |
| 306 | AM_RANGE(0x0806, 0x0806) AM_WRITE(flyball_pitcher_vert_w) |
| 307 | AM_RANGE(0x0807, 0x0807) AM_WRITE(flyball_pitcher_horz_w) |
| 308 | AM_RANGE(0x0900, 0x0900) AM_WRITE(flyball_potmask_w) |
| 309 | AM_RANGE(0x0a00, 0x0a07) AM_WRITE(flyball_misc_w) |
| 310 | AM_RANGE(0x0b00, 0x0b00) AM_READ(flyball_input_r) |
| 318 | 311 | AM_RANGE(0x0d00, 0x0eff) AM_WRITEONLY AM_SHARE("playfield_ram") |
| 319 | 312 | AM_RANGE(0x1000, 0x1fff) AM_ROM AM_REGION("maincpu", 0) |
| 320 | 313 | ADDRESS_MAP_END |
| r244656 | r244657 | |
| 428 | 421 | for (int i = 0; i < len; i++) |
| 429 | 422 | buf[i ^ 0x1ff] = ROM[i]; |
| 430 | 423 | memcpy(ROM, buf, len); |
| 431 | | |
| 432 | | m_pot_clear_timer = timer_alloc(TIMER_POT_CLEAR); |
| 433 | | m_quarter_timer = timer_alloc(TIMER_QUARTER); |
| 434 | 424 | |
| 435 | 425 | save_item(NAME(m_pitcher_vert)); |
| 436 | 426 | save_item(NAME(m_pitcher_horz)); |
| r244656 | r244657 | |
| 443 | 433 | |
| 444 | 434 | void flyball_state::machine_reset() |
| 445 | 435 | { |
| 446 | | m_quarter_timer->adjust(m_screen->time_until_pos(0)); |
| 436 | timer_set(m_screen->time_until_pos(0), TIMER_FLYBALL_QUARTER); |
| 447 | 437 | |
| 448 | 438 | m_pitcher_vert = 0; |
| 449 | 439 | m_pitcher_horz = 0; |
| r244656 | r244657 | |
| 467 | 457 | MCFG_SCREEN_REFRESH_RATE(60) |
| 468 | 458 | MCFG_SCREEN_SIZE(256, 262) |
| 469 | 459 | MCFG_SCREEN_VISIBLE_AREA(0, 255, 0, 239) |
| 470 | | MCFG_SCREEN_UPDATE_DRIVER(flyball_state, screen_update) |
| 460 | MCFG_SCREEN_UPDATE_DRIVER(flyball_state, screen_update_flyball) |
| 471 | 461 | MCFG_SCREEN_PALETTE("palette") |
| 472 | 462 | |
| 473 | 463 | MCFG_GFXDECODE_ADD("gfxdecode", "palette", flyball) |
| r244656 | r244657 | |
| 535 | 525 | * |
| 536 | 526 | *************************************/ |
| 537 | 527 | |
| 538 | | GAME( 1976, flyball, 0, flyball, flyball, driver_device, 0, 0, "Atari", "Flyball (rev 2)", GAME_NO_SOUND | GAME_SUPPORTS_SAVE ) |
| 539 | | GAME( 1976, flyball1, flyball, flyball, flyball, driver_device, 0, 0, "Atari", "Flyball (rev 1)", GAME_NO_SOUND | GAME_SUPPORTS_SAVE ) |
| 528 | GAME( 1976, flyball, 0, flyball, flyball, driver_device, 0, 0, "Atari", "Flyball (rev 2)", GAME_NO_SOUND ) |
| 529 | GAME( 1976, flyball1, flyball, flyball, flyball, driver_device, 0, 0, "Atari", "Flyball (rev 1)", GAME_NO_SOUND ) |
trunk/src/osd/modules/render/draw13.c
| r244656 | r244657 | |
| 87 | 87 | { |
| 88 | 88 | friend class simple_list<texture_info>; |
| 89 | 89 | public: |
| 90 | | texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, const UINT32 flags); |
| 90 | texture_info(sdl_info13 *renderer, const render_texinfo &texsource, const quad_setup_data &setup, const UINT32 flags); |
| 91 | 91 | ~texture_info(); |
| 92 | 92 | |
| 93 | 93 | void set_data(const render_texinfo &texsource, const UINT32 flags); |
| r244656 | r244657 | |
| 118 | 118 | |
| 119 | 119 | private: |
| 120 | 120 | Uint32 m_sdl_access; |
| 121 | | SDL_Renderer * m_sdl_renderer; |
| 121 | sdl_info13 * m_renderer; |
| 122 | 122 | render_texinfo m_texinfo; // copy of the texture info |
| 123 | 123 | HashT m_hash; // hash value for the texture (must be >= pointer size) |
| 124 | 124 | UINT32 m_flags; // rendering flags |
| r244656 | r244657 | |
| 143 | 143 | { |
| 144 | 144 | public: |
| 145 | 145 | sdl_info13(osd_window *w) |
| 146 | | : osd_renderer(w, FLAG_NONE), m_blittimer(0), m_sdl_renderer(NULL), |
| 146 | : osd_renderer(w, FLAG_NONE), m_sdl_renderer(NULL), m_blittimer(0), |
| 147 | 147 | m_last_hofs(0), m_last_vofs(0), |
| 148 | 148 | m_width(0), m_height(0), |
| 149 | 149 | m_blit_dim(0,0), |
| 150 | 150 | m_last_blit_time(0), m_last_blit_pixels(0) |
| 151 | | {} |
| 151 | { |
| 152 | for (int i=0; i < 30; i++) |
| 153 | { |
| 154 | fmt_support[i].format = 0; |
| 155 | fmt_support[i].status = 0; |
| 156 | } |
| 157 | } |
| 152 | 158 | |
| 153 | 159 | /* virtual */ int create(); |
| 154 | 160 | /* virtual */ int draw(const int update); |
| r244656 | r244657 | |
| 165 | 171 | window().target()->set_bounds(m_blit_dim.width(), m_blit_dim.height(), window().aspect()); |
| 166 | 172 | return &window().target()->get_primitives(); |
| 167 | 173 | } |
| 174 | int RendererSupportsFormat(Uint32 format, Uint32 access, const char *sformat); |
| 168 | 175 | |
| 176 | SDL_Renderer * m_sdl_renderer; |
| 177 | |
| 169 | 178 | private: |
| 170 | 179 | void render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y); |
| 171 | 180 | |
| r244656 | r244657 | |
| 183 | 192 | SDL_Surface *m_sdlsurf; |
| 184 | 193 | #endif |
| 185 | 194 | |
| 186 | | SDL_Renderer * m_sdl_renderer; |
| 187 | 195 | simple_list<texture_info> m_texlist; // list of active textures |
| 188 | 196 | |
| 189 | 197 | float m_last_hofs; |
| r244656 | r244657 | |
| 194 | 202 | |
| 195 | 203 | osd_dim m_blit_dim; |
| 196 | 204 | |
| 205 | struct |
| 206 | { |
| 207 | Uint32 format; |
| 208 | int status; |
| 209 | } fmt_support[30]; |
| 210 | |
| 197 | 211 | // Stats |
| 198 | 212 | INT64 m_last_blit_time; |
| 199 | 213 | INT64 m_last_blit_pixels; |
| r244656 | r244657 | |
| 317 | 331 | |
| 318 | 332 | static copy_info_t *blit_info[SDL_TEXFORMAT_LAST+1]; |
| 319 | 333 | |
| 320 | | static struct |
| 321 | | { |
| 322 | | Uint32 format; |
| 323 | | int status; |
| 324 | | } fmt_support[30] = { { 0, 0 } }; |
| 325 | | |
| 326 | | |
| 327 | 334 | //============================================================ |
| 328 | 335 | // INLINES |
| 329 | 336 | //============================================================ |
| r244656 | r244657 | |
| 400 | 407 | |
| 401 | 408 | SDL_SetTextureBlendMode(m_texture_id, m_sdl_blendmode); |
| 402 | 409 | set_coloralphamode(m_texture_id, &prim->color); |
| 403 | | SDL_RenderCopy(m_sdl_renderer, m_texture_id, NULL, &target_rect); |
| 410 | SDL_RenderCopy(m_renderer->m_sdl_renderer, m_texture_id, NULL, &target_rect); |
| 404 | 411 | } |
| 405 | 412 | |
| 406 | 413 | void sdl_info13::render_quad(texture_info *texture, const render_primitive *prim, const int x, const int y) |
| r244656 | r244657 | |
| 440 | 447 | } |
| 441 | 448 | } |
| 442 | 449 | |
| 443 | | static int RendererSupportsFormat(SDL_Renderer *renderer, Uint32 format, Uint32 access, const char *sformat) |
| 450 | int sdl_info13::RendererSupportsFormat(Uint32 format, Uint32 access, const char *sformat) |
| 444 | 451 | { |
| 445 | 452 | int i; |
| 446 | 453 | SDL_Texture *texid; |
| r244656 | r244657 | |
| 454 | 461 | /* not tested yet */ |
| 455 | 462 | fmt_support[i].format = format; |
| 456 | 463 | fmt_support[i + 1].format = 0; |
| 457 | | texid = SDL_CreateTexture(renderer, format, access, 16, 16); |
| 464 | texid = SDL_CreateTexture(m_sdl_renderer, format, access, 16, 16); |
| 458 | 465 | if (texid) |
| 459 | 466 | { |
| 460 | 467 | fmt_support[i].status = 1; |
| r244656 | r244657 | |
| 545 | 552 | int i; |
| 546 | 553 | copy_info_t *bi, *freeme; |
| 547 | 554 | for (i = 0; i <= SDL_TEXFORMAT_LAST; i++) |
| 555 | { |
| 548 | 556 | for (bi = blit_info[i]; bi != NULL; ) |
| 549 | 557 | { |
| 550 | 558 | if (bi->pixel_count) |
| r244656 | r244657 | |
| 555 | 563 | bi = bi->next; |
| 556 | 564 | global_free(freeme); |
| 557 | 565 | } |
| 566 | blit_info[i] = NULL; |
| 567 | } |
| 558 | 568 | } |
| 559 | 569 | |
| 560 | 570 | //============================================================ |
| r244656 | r244657 | |
| 796 | 806 | if ((m_is_rotated == bi->blitter->m_is_rot) |
| 797 | 807 | && (m_sdl_blendmode == bi->bm_mask)) |
| 798 | 808 | { |
| 799 | | if (RendererSupportsFormat(m_sdl_renderer, bi->dst_fmt, m_sdl_access, bi->dstname)) |
| 809 | if (m_renderer->RendererSupportsFormat(bi->dst_fmt, m_sdl_access, bi->dstname)) |
| 800 | 810 | { |
| 801 | 811 | int perf = bi->perf; |
| 802 | 812 | if (perf == 0) |
| r244656 | r244657 | |
| 816 | 826 | { |
| 817 | 827 | if ((m_is_rotated == bi->blitter->m_is_rot) |
| 818 | 828 | && (m_sdl_blendmode == bi->bm_mask)) |
| 819 | | if (RendererSupportsFormat(m_sdl_renderer, bi->dst_fmt, m_sdl_access, bi->dstname)) |
| 829 | if (m_renderer->RendererSupportsFormat(bi->dst_fmt, m_sdl_access, bi->dstname)) |
| 820 | 830 | return bi; |
| 821 | 831 | } |
| 822 | 832 | //FIXME: crash implement a -do nothing handler */ |
| r244656 | r244657 | |
| 851 | 861 | // texture_create |
| 852 | 862 | //============================================================ |
| 853 | 863 | |
| 854 | | texture_info::texture_info(SDL_Renderer *renderer, const render_texinfo &texsource, const quad_setup_data &setup, UINT32 flags) |
| 864 | texture_info::texture_info(sdl_info13 *renderer, const render_texinfo &texsource, const quad_setup_data &setup, UINT32 flags) |
| 855 | 865 | { |
| 856 | 866 | // fill in the core data |
| 857 | | m_sdl_renderer = renderer; |
| 867 | m_renderer = renderer; |
| 858 | 868 | m_hash = texture_compute_hash(texsource, flags); |
| 859 | 869 | m_flags = flags; |
| 860 | 870 | m_texinfo = texsource; |
| r244656 | r244657 | |
| 903 | 913 | |
| 904 | 914 | m_copyinfo = compute_size_type(); |
| 905 | 915 | |
| 906 | | m_texture_id = SDL_CreateTexture(m_sdl_renderer, m_copyinfo->dst_fmt, m_sdl_access, |
| 916 | m_texture_id = SDL_CreateTexture(m_renderer->m_sdl_renderer, m_copyinfo->dst_fmt, m_sdl_access, |
| 907 | 917 | m_setup.rotwidth, m_setup.rotheight); |
| 908 | 918 | |
| 909 | 919 | if (!m_texture_id) |
| r244656 | r244657 | |
| 1076 | 1086 | // if we didn't find one, create a new texture |
| 1077 | 1087 | if (texture == NULL && prim.texture.base != NULL) |
| 1078 | 1088 | { |
| 1079 | | texture = global_alloc(texture_info(m_sdl_renderer, prim.texture, setup, prim.flags)); |
| 1089 | texture = global_alloc(texture_info(this, prim.texture, setup, prim.flags)); |
| 1080 | 1090 | /* add us to the texture list */ |
| 1081 | 1091 | m_texlist.prepend(*texture); |
| 1082 | 1092 | |