Skip to content

Commit

Permalink
Moved Cave drivers and devices to atlus project and a new cave projec…
Browse files Browse the repository at this point in the history
…t. (#12090)
  • Loading branch information
angelosa committed Mar 4, 2024
1 parent bfef33b commit 7db1458
Show file tree
Hide file tree
Showing 20 changed files with 124 additions and 148 deletions.
22 changes: 0 additions & 22 deletions scripts/src/video.lua
Expand Up @@ -247,28 +247,6 @@ if (VIDEOS["EF9365"]~=null) then
}
end

--------------------------------------------------
--@src/devices/video/epic12.h,VIDEOS["EPIC12"] = true
--------------------------------------------------

if (VIDEOS["EPIC12"]~=null) then
files {
MAME_DIR .. "src/devices/video/epic12.cpp",
MAME_DIR .. "src/devices/video/epic12.h",
MAME_DIR .. "src/devices/video/epic12_blit0.cpp",
MAME_DIR .. "src/devices/video/epic12_blit1.cpp",
MAME_DIR .. "src/devices/video/epic12_blit2.cpp",
MAME_DIR .. "src/devices/video/epic12_blit3.cpp",
MAME_DIR .. "src/devices/video/epic12_blit4.cpp",
MAME_DIR .. "src/devices/video/epic12_blit5.cpp",
MAME_DIR .. "src/devices/video/epic12_blit6.cpp",
MAME_DIR .. "src/devices/video/epic12_blit7.cpp",
MAME_DIR .. "src/devices/video/epic12_blit8.cpp",
MAME_DIR .. "src/devices/video/epic12in.hxx",
MAME_DIR .. "src/devices/video/epic12pixel.hxx",
}
end

--------------------------------------------------
--
--@src/devices/video/fixfreq.h,VIDEOS["FIXFREQ"] = true
Expand Down
3 changes: 3 additions & 0 deletions src/mame/misc/cave.cpp → src/mame/atlus/cave.cpp
Expand Up @@ -46,6 +46,9 @@ Year + Game License PCB Tilemaps Sprites
To Do:
- Modernize state objects for each PCB sub-variant, rename to something more
apt than "cave_state";
- Sprite lag in some games (e.g. metmqstr). The sprites chip probably
generates interrupts (unknown_irq)
Expand Down
6 changes: 3 additions & 3 deletions src/mame/misc/cave.h → src/mame/atlus/cave.h
@@ -1,7 +1,7 @@
// license:BSD-3-Clause
// copyright-holders:Luca Elia
#ifndef MAME_MISC_CAVE_H
#define MAME_MISC_CAVE_H
#ifndef MAME_ATLUS_CAVE_H
#define MAME_ATLUS_CAVE_H

#pragma once

Expand Down Expand Up @@ -391,4 +391,4 @@ class ppsatan_state : public cave_state
void ppsatan_map(address_map &map);
};

#endif // MAME_MISC_CAVE_H
#endif // MAME_ATLUS_CAVE_H
File renamed without changes.
File renamed without changes.
8 changes: 5 additions & 3 deletions src/mame/misc/cv1k.cpp → src/mame/cave/cv1k.cpp
Expand Up @@ -190,12 +190,13 @@ Timing

#include "emu.h"

#include "epic12.h"

#include "cpu/sh/sh3comn.h"
#include "cpu/sh/sh4.h"
#include "machine/nandflash.h"
#include "machine/rtc9701.h"
#include "sound/ymz770.h"
#include "video/epic12.h"

#include "screen.h"
#include "speaker.h"
Expand Down Expand Up @@ -945,9 +946,10 @@ ROM_END

uint64_t cv1k_state::speedup_r()
{
offs_t pc = m_maincpu->pc();
const offs_t pc = m_maincpu->pc();

if (pc == m_idlepc || pc == m_idlepc + 2) m_maincpu->spin_until_time(attotime::from_usec(10));
if (pc == m_idlepc || pc == m_idlepc + 2)
m_maincpu->spin_until_time(attotime::from_usec(10));

return m_ram[m_idleramoffs / 8];
}
Expand Down
17 changes: 5 additions & 12 deletions src/devices/video/epic12.cpp → src/mame/cave/epic12.cpp
Expand Up @@ -129,7 +129,7 @@ void epic12_device::device_reset()
m_blitter_busy = 0;
}

// todo, get these into the device class without ruining performance
// TODO: get these into the device class without ruining performance
u8 epic12_device::colrtable[0x20][0x40];
u8 epic12_device::colrtable_rev[0x20][0x40];
u8 epic12_device::colrtable_add[0x20][0x20];
Expand Down Expand Up @@ -727,7 +727,7 @@ void epic12_device::gfx_create_shadow_copy(address_space &space)
}


void epic12_device::gfx_exec(void)
void epic12_device::gfx_exec()
{
offs_t addr = m_gfx_addr_shadowcopy & 0x1fffffff;
m_clip.set(m_gfx_clip_x_shadowcopy - EP1C_CLIP_MARGIN, m_gfx_clip_x_shadowcopy + 320 - 1 + EP1C_CLIP_MARGIN,
Expand Down Expand Up @@ -865,7 +865,6 @@ void epic12_device::draw_screen(bitmap_rgb32 &bitmap, const rectangle &cliprect)
int scroll_x = -m_gfx_scroll_x;
int scroll_y = -m_gfx_scroll_y;


#if DEBUG_VRAM_VIEWER
if (m_debug_vram_view_en)
copybitmap(bitmap, *m_bitmaps, 0, 0, 0, 0, cliprect);
Expand Down Expand Up @@ -942,14 +941,8 @@ void epic12_device::install_handlers(int addr1, int addr2)
{
address_space &space = m_maincpu->space(AS_PROGRAM);

read32s_delegate read(*this);
write32_delegate write(*this);

read = read32s_delegate(*this, FUNC(epic12_device::blitter_r));
write = write32_delegate(*this, FUNC(epic12_device::blitter_w));

space.install_read_handler(addr1, addr2, std::move(read), 0xffffffffffffffffU);
space.install_write_handler(addr1, addr2, std::move(write), 0xffffffffffffffffU);
space.install_read_handler(addr1, addr2, emu::rw_delegate(*this, FUNC(epic12_device::blitter_r)), 0xffffffffffffffffU);
space.install_write_handler(addr1, addr2, emu::rw_delegate(*this, FUNC(epic12_device::blitter_w)), 0xffffffffffffffffU);
}

u64 epic12_device::fpga_r()
Expand Down Expand Up @@ -977,7 +970,7 @@ void epic12_device::fpga_w(offs_t offset, u64 data, u64 mem_mask)
if (m_firmware_pos == 2323240)
{
u8 checksum = 0;
for(u8 c : m_firmware)
for (u8 c : m_firmware)
checksum += c;

switch (checksum)
Expand Down
8 changes: 4 additions & 4 deletions src/devices/video/epic12.h → src/mame/cave/epic12.h
@@ -1,8 +1,8 @@
// license:BSD-3-Clause
// copyright-holders:David Haywood, Luca Elia, MetalliC
/* emulation of Altera Cyclone EPIC12 FPGA programmed as a blitter */
#ifndef MAME_VIDEO_EPIC12_H
#define MAME_VIDEO_EPIC12_H
#ifndef MAME_CAVE_EPIC12_H
#define MAME_CAVE_EPIC12_H

#pragma once

Expand Down Expand Up @@ -58,7 +58,7 @@ class epic12_device : public device_t, public device_video_interface
inline void gfx_draw_shadow_copy(address_space &space, offs_t *addr);
inline void gfx_upload(offs_t *addr);
inline void gfx_draw(offs_t *addr);
void gfx_exec(void);
void gfx_exec();
u32 gfx_ready_r();
void gfx_exec_w(address_space &space, offs_t offset, u32 data, u32 mem_mask = ~0);

Expand Down Expand Up @@ -890,4 +890,4 @@ class epic12_device : public device_t, public device_video_interface

DECLARE_DEVICE_TYPE(EPIC12, epic12_device)

#endif // MAME_VIDEO_EPIC12_H
#endif // MAME_CAVE_EPIC12_H
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

9 comments on commit 7db1458

@MASHinfo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't make a TINY build of cv1k.cpp:
make -j5 TARGET=mame SUBTARGET=tinymame SOURCES=src/mame/cave/cv1k.cpp
It only build cv1k and epic12 and not the epic12_blit0-8 files.
Don't forget to do a make clean or backup your build directory.

@angelosa
Copy link
Member Author

@angelosa angelosa commented on 7db1458 Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

REGENIE=1, or alternatively bulk open and save all these files and it will catch up.

@MASHinfo
Copy link
Contributor

@MASHinfo MASHinfo commented on 7db1458 Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't work. The compiler did not create the epic12_blit0 - 8 files. They are missing.
Please build a TINY of cv1k.cpp with:
make -j5 TARGET=mame SUBTARGET=tinymame SOURCES=src/mame/cave/cv1k.cpp

Don't forget to do a make clean or backup your build directory!

@angelosa
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I tried, it builds with:

make -j6 SUBTARGET=tinymame SOURCES=^
src/mame/cave/cv1k.cpp,^
src/mame/cave/epic12_blit0.cpp,src/mame/cave/epic12_blit1.cpp,^
src/mame/cave/epic12_blit2.cpp,src/mame/cave/epic12_blit3.cpp,src/mame/cave/epic12_blit4.cpp,^
src/mame/cave/epic12_blit5.cpp,src/mame/cave/epic12_blit6.cpp,src/mame/cave/epic12_blit7.cpp,^
src/mame/cave/epic12_blit8.cpp^
 REGENIE=1

I'm legit puzzled and annoyed at what's inside these files, given they aren't "C++" ...

@MASHinfo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compile an ARCADE build with arcade.flt include cave/cv1k.cpp doesn't work also not.
make -j5 SUBTARGET=arcade

@MASHinfo
Copy link
Contributor

@MASHinfo MASHinfo commented on 7db1458 Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Find a way for Tiny and Arcade and the full MAME version.
Rename in src\mame\cave\ all ep1c12_blit0-8.cpp files to ep1c12_blit0-8.h.

In src\mame\cave\ep1c12.cpp add after #include "ep1c12.h":
#include "ep1c12_blit0.h"
#include "ep1c12_blit1.h"
#include "ep1c12_blit2.h"
#include "ep1c12_blit3.h"
#include "ep1c12_blit4.h"
#include "ep1c12_blit5.h"
#include "ep1c12_blit6.h"
#include "ep1c12_blit7.h"
#include "ep1c12_blit8.h"

Tested all versions and all cv1k.cpp are working!

@Robbbert
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also found this problem, but only with my "arcade" build. Even a clean build didn't fix it.

Knowing that partial builds are not really supported by the team, and I was pressed for time, I came up with my own, er, inventive solution.
MASH's idea appears better - I'll try it out in a few days.

@happppp
Copy link
Member

@happppp happppp commented on 7db1458 Mar 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you do a build with a flt file, isn't it simply a matter of adding "cave/ep1c12_b*.cpp" (keep the quotes)?

@Robbbert
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, that hadn't occurred to me, since flt files normally only include the actual game drivers. I can try that out when I get back later this week.

However, for a single-driver build, MASH's solution would work better.

I can see now why it doesn't work as is, because those blit files are never "included" anywhere, so the build system wouldn't ever know. It worked before because of the info in video.lua which has now been removed.

Please sign in to comment.