mirror of
https://github.com/holub/mame
synced 2025-04-19 23:12:11 +03:00
Soul-crushingly frustrating clean-up:
* Patched up a pile of code that was rotting behind UNUSED_FUNCTION, and switched to [[maybe_unused]] attribute so it can't rot so easily. * Reduced a bit more redundancy in fruit machine layouts.
This commit is contained in:
parent
989fd54201
commit
42f81753d2
@ -35,15 +35,13 @@ inline uint32_t get_UINT32BE(UINT32BE word)
|
||||
return (word.bytes[0] << 24) | (word.bytes[1] << 16) | (word.bytes[2] << 8) | word.bytes[3];
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
inline void set_UINT32BE(UINT32BE *word, uint32_t data)
|
||||
[[maybe_unused]] inline void set_UINT32BE(UINT32BE *word, uint32_t data)
|
||||
{
|
||||
word->bytes[0] = (data >> 24) & 0xff;
|
||||
word->bytes[1] = (data >> 16) & 0xff;
|
||||
word->bytes[2] = (data >> 8) & 0xff;
|
||||
word->bytes[3] = data & 0xff;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* SmartMedia image header */
|
||||
struct SM_disk_image_header
|
||||
|
@ -1036,7 +1036,6 @@ u16 aica_device::r16(u32 addr)
|
||||
}
|
||||
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
void aica_device::TimersAddTicks(int ticks)
|
||||
{
|
||||
if (m_TimCnt[0] <= 0xff00)
|
||||
@ -1075,7 +1074,6 @@ void aica_device::TimersAddTicks(int ticks)
|
||||
m_udata.data[0x98 / 2] |= m_TimCnt[2] >> 8;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
s32 aica_device::UpdateSlot(AICA_SLOT *slot)
|
||||
{
|
||||
@ -1380,14 +1378,6 @@ void aica_device::exec_dma()
|
||||
CheckPendingIRQ_SH4();
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
int aica_device::IRQCB(void *param)
|
||||
{
|
||||
CheckPendingIRQ(param);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
//-------------------------------------------------
|
||||
// sound_stream_update - handle a stream update
|
||||
//-------------------------------------------------
|
||||
|
@ -45,6 +45,7 @@ protected:
|
||||
virtual space_config_vector memory_space_config() const override;
|
||||
|
||||
address_space_config m_data_config;
|
||||
|
||||
private:
|
||||
enum AICA_STATE {AICA_ATTACK,AICA_DECAY1,AICA_DECAY2,AICA_RELEASE};
|
||||
|
||||
@ -123,7 +124,8 @@ private:
|
||||
void UpdateRegR(int reg);
|
||||
void w16(u32 addr,u16 val);
|
||||
u16 r16(u32 addr);
|
||||
inline s32 UpdateSlot(AICA_SLOT *slot);
|
||||
[[maybe_unused]] void TimersAddTicks(int ticks);
|
||||
s32 UpdateSlot(AICA_SLOT *slot);
|
||||
void DoMasterSamples(std::vector<read_stream_view> const &inputs, write_stream_view &bufl, write_stream_view &bufr);
|
||||
void exec_dma();
|
||||
|
||||
|
@ -416,7 +416,7 @@ uint8_t mos6560_device::read(offs_t offset)
|
||||
break;
|
||||
case 6: /*lightpen horizontal */
|
||||
case 7: /*lightpen vertical */
|
||||
#ifdef UNUSED_FUNCTION
|
||||
#if 0
|
||||
if (LIGHTPEN_BUTTON && ((machine().time().as_double() - m_lightpenreadtime) * MOS656X_VRETRACERATE >= 1))
|
||||
{
|
||||
/* only 1 update each frame */
|
||||
|
@ -1427,14 +1427,6 @@ void scsp_device::exec_dma()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
int IRQCB(void *param)
|
||||
{
|
||||
CheckPendingIRQ(param);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
u16 scsp_device::read(offs_t offset)
|
||||
{
|
||||
|
@ -438,19 +438,6 @@ uint32_t saturn_state::saturn_vdp1_framebuffer0_r(offs_t offset, uint32_t mem_ma
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
void saturn_state::saturn_vdp1_framebuffer1_w(offs_t offset, uint32_t data)
|
||||
{
|
||||
//popmessage ("STV VDP1 Framebuffer 1 WRITE offset %08x data %08x",offset, data);
|
||||
}
|
||||
|
||||
uint32_t saturn_state::saturn_vdp1_framebuffer1_r()
|
||||
{
|
||||
//popmessage ("STV VDP1 Framebuffer 1 READ offset %08x",offset);
|
||||
return 0xffff;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
@ -5597,7 +5597,7 @@ void saturn_state::stv_vdp2_draw_rotation_screen(bitmap_rgb32 &bitmap, const rec
|
||||
stv2_current_tilemap.transparency |= STV_TRANSPARENCY_ALPHA;
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
#if 0
|
||||
// old reference code
|
||||
mycliprect = cliprect;
|
||||
|
||||
@ -5608,7 +5608,7 @@ void saturn_state::stv_vdp2_draw_rotation_screen(bitmap_rgb32 &bitmap, const rec
|
||||
stv2_current_tilemap.window_control.enabled[0] = 0;
|
||||
stv2_current_tilemap.window_control.enabled[1] = 0;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
stv2_current_tilemap.fade_control = fade_control;
|
||||
|
||||
|
@ -281,7 +281,7 @@ public:
|
||||
} else
|
||||
{
|
||||
if (m_zeusbase[0x57] & 0x4)
|
||||
m_frameColor[addr + 1] = m_zeusbase[0x59];
|
||||
m_frameColor[addr + 1] = m_zeusbase[0x59];
|
||||
if (m_zeusbase[0x57] & 0x10)
|
||||
*(uint32_t*)&m_frameDepth[addr] = m_zeusbase[0x5a];
|
||||
}
|
||||
@ -300,13 +300,11 @@ public:
|
||||
return WAVERAM_BLOCK0(blocknum);
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
inline void *waveram0_ptr_from_texture_addr(uint32_t addr, int width)
|
||||
[[maybe_unused]] inline void *waveram0_ptr_from_texture_addr(uint32_t addr, int width)
|
||||
{
|
||||
uint32_t blocknum = ((addr & ~1) * width) / 8;
|
||||
return WAVERAM_BLOCK0(blocknum);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*************************************
|
||||
* Inlines for rendering
|
||||
@ -328,51 +326,51 @@ public:
|
||||
result |= ((((color) << 6) & 0xc0) | (((color) << 4) & 0x30) | (((color) << 2) & 0x0c) | (((color) << 0) & 0x03)) << 0;
|
||||
return result;
|
||||
}
|
||||
#ifdef UNUSED_FUNCTION
|
||||
inline void WAVERAM_plot(int y, int x, uint32_t color)
|
||||
{
|
||||
if (zeus_cliprect.contains(x, y))
|
||||
WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
inline void waveram_plot_depth(int y, int x, uint32_t color, uint16_t depth)
|
||||
[[maybe_unused]] inline void WAVERAM_plot(int y, int x, uint32_t color)
|
||||
{
|
||||
if (zeus_cliprect.contains(x, y))
|
||||
{
|
||||
WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
|
||||
WAVERAM_WRITEDEPTH(zeus_renderbase, y, x, depth);
|
||||
uint32_t addr = frame_addr_from_xy(x, y, true);
|
||||
m_frameColor[addr] = color;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
inline void waveram_plot_check_depth(int y, int x, uint32_t color, uint16_t depth)
|
||||
[[maybe_unused]] inline void waveram_plot_depth(int y, int x, uint32_t color, int32_t depth)
|
||||
{
|
||||
if (zeus_cliprect.contains(x, y))
|
||||
{
|
||||
uint16_t *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x);
|
||||
uint32_t addr = frame_addr_from_xy(x, y, true);
|
||||
m_frameColor[addr] = color;
|
||||
m_frameDepth[addr] = depth;
|
||||
}
|
||||
}
|
||||
|
||||
[[maybe_unused]] inline void waveram_plot_check_depth(int y, int x, uint32_t color, int32_t depth)
|
||||
{
|
||||
if (zeus_cliprect.contains(x, y))
|
||||
{
|
||||
uint32_t addr = frame_addr_from_xy(x, y, true);
|
||||
int32_t *depthptr = &m_frameDepth[addr];
|
||||
if (depth <= *depthptr)
|
||||
{
|
||||
WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
|
||||
m_frameColor[addr] = color;
|
||||
*depthptr = depth;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
inline void waveram_plot_check_depth_nowrite(int y, int x, uint32_t color, uint16_t depth)
|
||||
[[maybe_unused]] inline void waveram_plot_check_depth_nowrite(int y, int x, uint32_t color, int32_t depth)
|
||||
{
|
||||
if (zeus_cliprect.contains(x, y))
|
||||
{
|
||||
uint16_t *depthptr = WAVERAM_PTRDEPTH(zeus_renderbase, y, x);
|
||||
uint32_t addr = frame_addr_from_xy(x, y, true);
|
||||
int32_t *depthptr = &m_frameDepth[addr];
|
||||
if (depth <= *depthptr)
|
||||
WAVERAM_WRITEPIX(zeus_renderbase, y, x, color);
|
||||
m_frameColor[addr] = color;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*************************************
|
||||
* Inlines for texel accesses
|
||||
*************************************/
|
||||
|
@ -252,41 +252,36 @@ const cassette_image::Format cassette_image::wavfile_format =
|
||||
This code has already identified some rounding errors
|
||||
*********************************************************************/
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
void wavfile_testload(const char *fname)
|
||||
[[maybe_unused]] void wavfile_testload(const char *fname)
|
||||
{
|
||||
cassette_image *cassette;
|
||||
FILE *f;
|
||||
long offset;
|
||||
int freq, samples, i;
|
||||
int32_t cassamp;
|
||||
int16_t wavsamp;
|
||||
|
||||
f = fopen(fname, "rb");
|
||||
FILE *f = fopen(fname, "rb");
|
||||
if (!f)
|
||||
return;
|
||||
|
||||
if (cassette_open(f, &stdio_ioprocs, &wavfile_format, cassette_image::FLAG_READONLY, &cassette))
|
||||
cassette_image::ptr cassette;
|
||||
if (cassette_image::open(util::stdio_read_write_noclose(f, 0x00), &cassette_image::wavfile_format, cassette_image::FLAG_READONLY, cassette) != cassette_image::error::SUCCESS)
|
||||
{
|
||||
fclose(f);
|
||||
return;
|
||||
}
|
||||
|
||||
offset = 44;
|
||||
freq = 44100;
|
||||
samples = 5667062;
|
||||
constexpr long offset = 44;
|
||||
constexpr int freq = 44100;
|
||||
constexpr int samples = 5667062;
|
||||
|
||||
for (i = 0; i < samples; i++)
|
||||
for (int i = 0; i < samples; i++)
|
||||
{
|
||||
cassette_get_sample(cassette, 0, i / (double) freq, 0.0, &cassamp);
|
||||
int32_t cassamp;
|
||||
cassette->get_sample(0, i / double(freq), 0.0, &cassamp);
|
||||
|
||||
int16_t wavsamp;
|
||||
fseek(f, offset + i * 2, SEEK_SET);
|
||||
fread(&wavsamp, 1, 2, f);
|
||||
assert(cassamp == (((uint32_t) wavsamp) << 16));
|
||||
|
||||
assert(cassamp == (uint32_t(wavsamp) << 16));
|
||||
}
|
||||
|
||||
cassette_close(cassette);
|
||||
cassette.reset();
|
||||
|
||||
fclose(f);
|
||||
}
|
||||
#endif
|
||||
|
@ -55,13 +55,6 @@ void m90_state::quizf1_bankswitch_w(offs_t offset, uint16_t data, uint16_t mem_m
|
||||
m_mainbank->set_entry(data & 0xf);
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
void m90_state::unknown_w(uint16_t data)
|
||||
{
|
||||
printf("%04x ",data);
|
||||
}
|
||||
#endif
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
void m90_state::m90_main_cpu_map(address_map &map)
|
||||
@ -122,11 +115,11 @@ void m90_state::dynablsb_main_cpu_io_map(address_map &map)
|
||||
map(0x00, 0x01).portr("P1_P2");
|
||||
map(0x02, 0x03).w(FUNC(m90_state::coincounter_w));
|
||||
map(0x02, 0x03).portr("SYSTEM");
|
||||
// map(0x04, 0x05).w(FUNC(m90_state::unknown_w)); /* dynablsb: write continuously 0x6000 */
|
||||
// map(0x04, 0x05).w(NAME([] (uint16_t data) { printf("%04x ", data); })); /* dynablsb: write continuously 0x6000 */
|
||||
map(0x04, 0x05).portr("DSW");
|
||||
map(0x06, 0x07).portr("P3_P4");
|
||||
map(0x80, 0x8f).writeonly().share("video_control");
|
||||
// map(0x90, 0x91).w(FUNC(m90_state::unknown_w));
|
||||
// map(0x90, 0x91).w(NAME([] (uint16_t data) { printf("%04x ", data); }));
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -177,7 +177,7 @@ inline void pc6001_state::ppi_control_hack_w(uint8_t data)
|
||||
else
|
||||
m_port_c_8255 &= ~(1<<((data>>1)&0x07));
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
#if 0
|
||||
// this switch-case is overwritten below anyway!?
|
||||
switch(data)
|
||||
{
|
||||
@ -187,7 +187,7 @@ inline void pc6001_state::ppi_control_hack_w(uint8_t data)
|
||||
case 0x0d: m_port_c_8255 &= 0xf7; break;
|
||||
default: break;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
m_port_c_8255 |= 0xa8;
|
||||
}
|
||||
@ -942,7 +942,7 @@ void pc6001mk2sr_state::necsr_ppi8255_w(offs_t offset, u8 data)
|
||||
{
|
||||
ppi_control_hack_w(data);
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
#if 0
|
||||
{
|
||||
//printf("%02x\n",data);
|
||||
|
||||
@ -951,7 +951,7 @@ void pc6001mk2sr_state::necsr_ppi8255_w(offs_t offset, u8 data)
|
||||
if ((data & 0x0f) == 0x04)
|
||||
m_bank1->set_base(m_region_gfx1->base());
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
m_ppi->write(offset,data);
|
||||
|
@ -1792,9 +1792,9 @@ TIMER_CALLBACK_MEMBER(viper_state::ds2430_timer_callback)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
uint64_t viper_state::input_r(offs_t offset, uint64_t mem_mask)
|
||||
uint8_t viper_state::input_r(offs_t offset)
|
||||
{
|
||||
#if 0
|
||||
uint64_t r = 0;
|
||||
//return 0;//0x0000400000000000U;
|
||||
|
||||
@ -1837,12 +1837,9 @@ uint64_t viper_state::input_r(offs_t offset, uint64_t mem_mask)
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
#endif
|
||||
|
||||
uint8_t viper_state::input_r(offs_t offset)
|
||||
{
|
||||
#else
|
||||
return (m_io_ports[offset & 7])->read();
|
||||
#endif
|
||||
}
|
||||
|
||||
int viper_state::ds2430_insert_cmd_bit(int bit)
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -266,7 +266,7 @@ uint16_t tatsumi_state::tatsumi_v30_68000_r(offs_t offset)
|
||||
/* Read from 68k RAM */
|
||||
if ((m_control_word&0x1f)==0x18)
|
||||
{
|
||||
#ifdef UNUSED_FUNCTION
|
||||
#if 0
|
||||
// hack to make roundup 5 boot
|
||||
// doesn't seem necessary anymore, left for reference
|
||||
if (m_maincpu->pc()==0xec575)
|
||||
@ -282,7 +282,7 @@ uint16_t tatsumi_state::tatsumi_v30_68000_r(offs_t offset)
|
||||
dst[BYTE_XOR_LE(0xfc524)]=0x46;
|
||||
dst[BYTE_XOR_LE(0xfc525)]=0x46;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return m_sharedram[offset & 0x1fff];
|
||||
}
|
||||
@ -313,7 +313,7 @@ uint8_t cyclwarr_state::oki_status_xor_r()
|
||||
// fwiw returning normal oki status doesn't work at all, both games don't make any sound.
|
||||
// TODO: verify with HW
|
||||
return (r ^ 0xff);
|
||||
#ifdef UNUSED_FUNCTION
|
||||
#if 0
|
||||
// old hack left for reference
|
||||
|
||||
if (m_audiocpu->pc()==0x2b70 || m_audiocpu->pc()==0x2bb5
|
||||
@ -326,5 +326,5 @@ uint8_t cyclwarr_state::oki_status_xor_r()
|
||||
|| m_audiocpu->pc()==0x1cac) // BigFight
|
||||
return 0;
|
||||
return r;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
@ -729,7 +729,7 @@ u16 taito_f3_state::lineram_r(offs_t offset)
|
||||
|
||||
void taito_f3_state::lineram_w(offs_t offset, u16 data, u16 mem_mask)
|
||||
{
|
||||
#ifdef UNUSED_FUNCTION
|
||||
#if 0
|
||||
/* DariusGX has an interesting bug at the start of Round D - the clearing of lineram
|
||||
(0xa000->0x0xa7ff) overflows into priority RAM (0xb000) and creates garbage priority
|
||||
values. I'm not sure what the real machine would do with these values, and this
|
||||
@ -750,7 +750,7 @@ void taito_f3_state::lineram_w(offs_t offset, u16 data, u16 mem_mask)
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
COMBINE_DATA(&m_line_ram[offset]);
|
||||
}
|
||||
|
@ -1264,13 +1264,13 @@ uint32_t cyclwarr_state::screen_update_cyclwarr(screen_device &screen, bitmap_rg
|
||||
|
||||
bitmap.fill(m_palette->pen(0), cliprect);
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
#if 0
|
||||
popmessage("%04x %04x (%04x)|%04x %04x (%04x)|%04x %04x (%04x)|%04x %04x (%04x)"
|
||||
,m_cyclwarr_videoram[1][0x000],m_cyclwarr_videoram[1][0x100],m_cyclwarr_videoram[1][0x1ff]
|
||||
,m_cyclwarr_videoram[1][0x200],m_cyclwarr_videoram[1][0x300],m_cyclwarr_videoram[1][0x3ff]
|
||||
,m_cyclwarr_videoram[0][0x000],m_cyclwarr_videoram[0][0x100],m_cyclwarr_videoram[0][0x1ff]
|
||||
,m_cyclwarr_videoram[0][0x200],m_cyclwarr_videoram[0][0x300],m_cyclwarr_videoram[0][0x3ff]);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// popmessage("%04x %04x %04x %04x",m_video_config[0],m_video_config[1],m_video_config[2],m_video_config[3]);
|
||||
|
||||
|
@ -516,9 +516,8 @@ static imgtoolerr_t write_bitmap_block(imgtool::image &img, int block, const bit
|
||||
}
|
||||
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/* Read a bitmap extended block */
|
||||
static imgtoolerr_t read_bitmap_ext_block(imgtool::image *img, int block, bitmap_ext_block *bm)
|
||||
[[maybe_unused]] static imgtoolerr_t read_bitmap_ext_block(imgtool::image &img, int block, bitmap_ext_block *bm)
|
||||
{
|
||||
imgtoolerr_t ret;
|
||||
uint8_t buffer[BSIZE];
|
||||
@ -533,7 +532,6 @@ static imgtoolerr_t read_bitmap_ext_block(imgtool::image *img, int block, bitmap
|
||||
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Read the root block */
|
||||
@ -840,16 +838,14 @@ static int is_intl(imgtool::image &img)
|
||||
t == DT_FFS_INTL_DIRC) ? true : false);
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/* Returns true if the disk uses the directory cache mode */
|
||||
static int is_dirc(imgtool::image *img)
|
||||
[[maybe_unused]] static int is_dirc(imgtool::image &img)
|
||||
{
|
||||
disk_type t = get_disk_type(img);
|
||||
|
||||
return ((t == DT_OFS_INTL_DIRC ||
|
||||
t == DT_FFS_INTL_DIRC) ? true : false);
|
||||
}
|
||||
#endif
|
||||
|
||||
static imgtoolerr_t get_hash_table(imgtool::image &img, int block, uint32_t *ht)
|
||||
{
|
||||
@ -910,12 +906,10 @@ static imgtoolerr_t set_hash_table(imgtool::image &img, int block, const uint32_
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static imgtoolerr_t get_root_hash_table(imgtool::image *img, uint32_t *ht)
|
||||
[[maybe_unused]] static imgtoolerr_t get_root_hash_table(imgtool::image &img, uint32_t *ht)
|
||||
{
|
||||
return get_hash_table(img, get_total_blocks(img)/2, ht);
|
||||
}
|
||||
#endif
|
||||
|
||||
static imgtoolerr_t get_blockname(imgtool::image &img, int block, char *dest)
|
||||
{
|
||||
@ -1370,8 +1364,7 @@ static int get_first_bit(uint32_t *array, int size)
|
||||
}
|
||||
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static imgtoolerr_t walk_bitmap_ext_blocks(imgtool::image *img, int start, int *block)
|
||||
[[maybe_unused]] static imgtoolerr_t walk_bitmap_ext_blocks(imgtool::image &img, int start, int *block)
|
||||
{
|
||||
imgtoolerr_t ret;
|
||||
bitmap_ext_block bm_ext;
|
||||
@ -1403,7 +1396,6 @@ static imgtoolerr_t walk_bitmap_ext_blocks(imgtool::image *img, int start, int *
|
||||
/* else continue walking the list */
|
||||
return walk_bitmap_ext_blocks(img, bm_ext.next, block);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Searches for a block marked as free
|
||||
|
@ -204,7 +204,6 @@ static int read_physical_record(imgtool::stream &file_handle, int secnum, void *
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/*
|
||||
write_physical_record
|
||||
|
||||
@ -216,7 +215,7 @@ static int read_physical_record(imgtool::stream &file_handle, int secnum, void *
|
||||
|
||||
Return non-zero on error
|
||||
*/
|
||||
static int write_physical_record(imgtool::stream *file_handle, int secnum, const void *src)
|
||||
[[maybe_unused]] static int write_physical_record(imgtool::stream *file_handle, int secnum, const void *src)
|
||||
{
|
||||
int reply;
|
||||
|
||||
@ -231,7 +230,6 @@ static int write_physical_record(imgtool::stream *file_handle, int secnum, const
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Search for a file name on a concept_image
|
||||
|
@ -368,14 +368,12 @@ static imgtoolerr_t fat_write_sector(imgtool::partition &partition, uint32_t sec
|
||||
}
|
||||
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static imgtoolerr_t fat_clear_sector(imgtool::partition &partition, uint32_t sector_index, uint8_t data)
|
||||
[[maybe_unused]] static imgtoolerr_t fat_clear_sector(imgtool::partition &partition, uint32_t sector_index, uint8_t data)
|
||||
{
|
||||
char buf[FAT_SECLEN];
|
||||
memset(buf, data, sizeof(buf));
|
||||
return fat_write_sector(partition, sector_index, 0, buf, sizeof(buf));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static imgtoolerr_t fat_partition_open(imgtool::partition &partition, uint64_t first_block, uint64_t block_count)
|
||||
|
@ -146,19 +146,17 @@ static inline void set_UINT16BE(UINT16BE *word, uint16_t data)
|
||||
word->bytes[1] = data & 0xff;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static inline uint32_t get_UINT24BE(UINT24BE word)
|
||||
{
|
||||
return (word.bytes[0] << 16) | (word.bytes[1] << 8) | word.bytes[2];
|
||||
}
|
||||
|
||||
static inline void set_UINT24BE(UINT24BE *word, uint32_t data)
|
||||
[[maybe_unused]] static inline void set_UINT24BE(UINT24BE *word, uint32_t data)
|
||||
{
|
||||
word->bytes[0] = (data >> 16) & 0xff;
|
||||
word->bytes[1] = (data >> 8) & 0xff;
|
||||
word->bytes[2] = data & 0xff;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline uint32_t get_UINT32BE(UINT32BE word)
|
||||
{
|
||||
@ -439,8 +437,7 @@ exit:
|
||||
Return a zero if s1 and s2 are equal, a negative value if s1 is less than
|
||||
s2, and a positive value if s1 is greater than s2.
|
||||
*/
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static int mac_strcmp(const uint8_t *s1, const uint8_t *s2)
|
||||
[[maybe_unused]] static int mac_strcmp(const uint8_t *s1, const uint8_t *s2)
|
||||
{
|
||||
size_t common_len;
|
||||
|
||||
@ -448,7 +445,6 @@ static int mac_strcmp(const uint8_t *s1, const uint8_t *s2)
|
||||
|
||||
return memcmp(s1+1, s2+1, common_len) || ((int)s1[0] - s2[0]);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
mac_stricmp()
|
||||
@ -473,7 +469,7 @@ Known issues:
|
||||
you must consider that, unlike UNIX, the Macintosh was not designed for
|
||||
droids, but error-prone human beings that may forget about case.)
|
||||
|
||||
(Also, letters with diatrical signs follow the corresponding letters
|
||||
(Also, letters with diacritical signs follow the corresponding letters
|
||||
without diacritical signs in the HFS catalog file. This does not matter,
|
||||
though, since the Finder will not display files in the HFS catalog order,
|
||||
but it will instead sort files according to whatever order is currently
|
||||
@ -482,7 +478,7 @@ Known issues:
|
||||
However, with other text encodings, the behavior will be completely absurd.
|
||||
For instance, with the Greek encoding, it will think that the degree symbol
|
||||
is the same letter (with different case) as the upper-case Psi, so that if
|
||||
a program asks for a file called "90??" on a greek HFS volume, and there is
|
||||
a program asks for a file called "90??" on a Greek HFS volume, and there is
|
||||
a file called "90??" on this volume, file "90??" will be opened.
|
||||
Results will probably be even weirder with 2-byte scripts like Japanese or
|
||||
Chinese. Of course, we are not going to fix this issue, since doing so
|
||||
@ -592,7 +588,6 @@ static inline void mac_strcpy(uint8_t *dest, const uint8_t *src)
|
||||
memcpy(dest, src, src[0]+1);
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/*
|
||||
mac_strncpy()
|
||||
|
||||
@ -602,7 +597,7 @@ static inline void mac_strcpy(uint8_t *dest, const uint8_t *src)
|
||||
n (I): max string length for dest (range 0-255, buffer length + 1)
|
||||
src (I): source macintosh string (first byte is length)
|
||||
*/
|
||||
static void mac_strncpy(uint8_t *dest, int n, const uint8_t *src)
|
||||
[[maybe_unused]] static void mac_strncpy(uint8_t *dest, int n, const uint8_t *src)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
@ -612,7 +607,6 @@ static void mac_strncpy(uint8_t *dest, int n, const uint8_t *src)
|
||||
dest[0] = len;
|
||||
memcpy(dest+1, src+1, len);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
disk image reference
|
||||
@ -1061,9 +1055,7 @@ struct floppy_tag_record
|
||||
/* (DV17 says "disk block number", but it cannot be true) */
|
||||
};
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static void hfs_image_close(struct mac_l2_imgref *l2_img);
|
||||
#endif
|
||||
static void hfs_image_close(struct mac_l2_imgref &l2_img);
|
||||
static imgtoolerr_t mfs_file_get_nth_block_address(struct mac_fileref *fileref, uint32_t block_num, uint32_t *block_address);
|
||||
static imgtoolerr_t hfs_file_get_nth_block_address(struct mac_fileref *fileref, uint32_t block_num, uint32_t *block_address);
|
||||
static imgtoolerr_t mfs_lookup_path(struct mac_l2_imgref *l2_img, const char *fpath, mac_str255 filename, mac_dirent *cat_info, int create_it);
|
||||
@ -1079,7 +1071,6 @@ static struct mac_l2_imgref *get_imgref(imgtool::image &img)
|
||||
}
|
||||
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/*
|
||||
mac_image_close
|
||||
|
||||
@ -1087,9 +1078,9 @@ static struct mac_l2_imgref *get_imgref(imgtool::image &img)
|
||||
|
||||
l2_img (I/O): level-2 image reference
|
||||
*/
|
||||
static void mac_image_close(struct mac_l2_imgref *l2_img)
|
||||
static void mac_image_close(struct mac_l2_imgref &l2_img)
|
||||
{
|
||||
switch (l2_img->format)
|
||||
switch (l2_img.format)
|
||||
{
|
||||
case L2I_MFS:
|
||||
break;
|
||||
@ -1099,7 +1090,6 @@ static void mac_image_close(struct mac_l2_imgref *l2_img)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
mac_lookup_path
|
||||
@ -1348,7 +1338,6 @@ static imgtoolerr_t mac_file_write(struct mac_fileref *fileref, uint32_t len, co
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/*
|
||||
mac_file_tell
|
||||
|
||||
@ -1359,13 +1348,12 @@ static imgtoolerr_t mac_file_write(struct mac_fileref *fileref, uint32_t len, co
|
||||
|
||||
Return imgtool error code
|
||||
*/
|
||||
static imgtoolerr_t mac_file_tell(struct mac_fileref *fileref, uint32_t *filePos)
|
||||
[[maybe_unused]] static imgtoolerr_t mac_file_tell(struct mac_fileref *fileref, uint32_t *filePos)
|
||||
{
|
||||
*filePos = fileref->crPs;
|
||||
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
mac_file_seek
|
||||
@ -2732,7 +2720,6 @@ static imgtoolerr_t mfs_file_setABeof(struct mac_fileref *fileref, uint32_t newA
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/*
|
||||
mfs_hashString
|
||||
|
||||
@ -2768,7 +2755,6 @@ static int mfs_hashString(const mac_str255 string)
|
||||
|
||||
return reply;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#pragma mark -
|
||||
@ -3137,7 +3123,6 @@ static imgtoolerr_t hfs_image_open(imgtool::image &image, imgtool::stream::ptr &
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/*
|
||||
hfs_image_close
|
||||
|
||||
@ -3145,14 +3130,13 @@ static imgtoolerr_t hfs_image_open(imgtool::image &image, imgtool::stream::ptr &
|
||||
|
||||
l2_img (I/O): level-2 image reference
|
||||
*/
|
||||
static void hfs_image_close(struct mac_l2_imgref *l2_img)
|
||||
static void hfs_image_close(struct mac_l2_imgref &l2_img)
|
||||
{
|
||||
assert(l2_img->format == L2I_HFS);
|
||||
assert(l2_img.format == L2I_HFS);
|
||||
|
||||
BT_close(&l2_img->u.hfs.extents_BT);
|
||||
BT_close(&l2_img->u.hfs.cat_BT);
|
||||
BT_close(&l2_img.u.hfs.extents_BT);
|
||||
BT_close(&l2_img.u.hfs.cat_BT);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
hfs_get_cat_record_data
|
||||
@ -4925,7 +4909,6 @@ struct mac_resfileref
|
||||
/* This is actually part of the type list, which matters for offsets */
|
||||
};
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/*
|
||||
resfile_open
|
||||
|
||||
@ -5051,7 +5034,7 @@ static imgtoolerr_t resfile_get_entry(mac_resfileref *resfileref, uint32_t type,
|
||||
|
||||
Return imgtool error code
|
||||
*/
|
||||
static imgtoolerr_t resfile_get_resname(mac_resfileref *resfileref, const rsrc_ref_entry *entry, mac_str255 string)
|
||||
[[maybe_unused]] static imgtoolerr_t resfile_get_resname(mac_resfileref *resfileref, const rsrc_ref_entry *entry, mac_str255 string)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
uint16_t name_offs;
|
||||
@ -5169,7 +5152,6 @@ static imgtoolerr_t resfile_get_resdata(mac_resfileref *resfileref, const rsrc_r
|
||||
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#pragma mark -
|
||||
@ -5212,7 +5194,6 @@ static imgtoolerr_t resfile_get_resdata(mac_resfileref *resfileref, const rsrc_r
|
||||
many programs/comments
|
||||
*/
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/*
|
||||
get_comment
|
||||
|
||||
@ -5270,16 +5251,13 @@ static imgtoolerr_t get_comment(struct mac_l2_imgref *l2_img, uint16_t id, mac_s
|
||||
/* phew, we are done! */
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#pragma mark -
|
||||
#pragma mark IMGTOOL MODULE IMPLEMENTATION
|
||||
#endif
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static void mac_image_exit(imgtool::image *img);
|
||||
#endif
|
||||
[[maybe_unused]] static void mac_image_exit(imgtool::image &img);
|
||||
static void mac_image_info(imgtool::image &img, std::ostream &stream);
|
||||
static imgtoolerr_t mac_image_beginenum(imgtool::directory &enumeration, const char *path);
|
||||
static imgtoolerr_t mac_image_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent);
|
||||
@ -5287,17 +5265,15 @@ static imgtoolerr_t mac_image_freespace(imgtool::partition &partition, uint64_t
|
||||
static imgtoolerr_t mac_image_readfile(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &destf);
|
||||
static imgtoolerr_t mac_image_writefile(imgtool::partition &partition, const char *filename, const char *fork, imgtool::stream &sourcef, util::option_resolution *writeoptions);
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/*
|
||||
close a mfs/hfs image
|
||||
*/
|
||||
static void mac_image_exit(imgtool::image *img)
|
||||
static void mac_image_exit(imgtool::image &img)
|
||||
{
|
||||
struct mac_l2_imgref *image = get_imgref(img);
|
||||
|
||||
mac_image_close(image);
|
||||
mac_image_close(*image);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
get basic information on a mfs/hfs image
|
||||
@ -5588,8 +5564,7 @@ static imgtoolerr_t mac_image_freespace(imgtool::partition &partition, uint64_t
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static imgtoolerr_t mac_get_comment(struct mac_l2_imgref *image, mac_str255 filename, const mac_dirent *cat_info, mac_str255 comment)
|
||||
[[maybe_unused]] static imgtoolerr_t mac_get_comment(struct mac_l2_imgref *image, mac_str255 filename, const mac_dirent *cat_info, mac_str255 comment)
|
||||
{
|
||||
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
|
||||
uint16_t commentID;
|
||||
@ -5614,7 +5589,6 @@ static imgtoolerr_t mac_get_comment(struct mac_l2_imgref *image, mac_str255 file
|
||||
}
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
|
@ -1303,15 +1303,13 @@ static void dsk_aphysrec_to_sector_address(int aphysrec, const ti99_geometry *ge
|
||||
geometry (I): disk image geometry
|
||||
address (O): physical sector address
|
||||
*/
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static void win_aphysrec_to_sector_address(int aphysrec, const ti99_geometry *geometry, ti99_sector_address *address)
|
||||
[[maybe_unused]] static void win_aphysrec_to_sector_address(int aphysrec, const ti99_geometry &geometry, ti99_sector_address &address)
|
||||
{
|
||||
address.sector = aphysrec % l1_img->geometry.secspertrack;
|
||||
aphysrec /= l1_img->geometry.secspertrack;
|
||||
address.side = aphysrec % l1_img->geometry.heads;
|
||||
address.cylinder = aphysrec / l1_img->geometry.heads;
|
||||
address.sector = aphysrec % geometry.secspertrack;
|
||||
aphysrec /= geometry.secspertrack;
|
||||
address.side = aphysrec % geometry.heads;
|
||||
address.cylinder = aphysrec / geometry.heads;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Read one 256-byte physical record from a disk image
|
||||
@ -1330,7 +1328,7 @@ static int read_absolute_physrec(ti99_lvl1_imgref *l1_img, unsigned aphysrec, vo
|
||||
if (l1_img->img_format == if_harddisk)
|
||||
{
|
||||
#if 0
|
||||
win_aphysrec_to_sector_address(aphysrec, & l1_img->geometry, & address);
|
||||
win_aphysrec_to_sector_address(aphysrec, l1_img->geometry, address);
|
||||
return read_sector(l1_img, & address, dest);
|
||||
#endif
|
||||
|
||||
@ -3307,8 +3305,7 @@ static int write_file_physrec(struct ti99_lvl2_fileref *l2_file, unsigned fphysr
|
||||
/*
|
||||
Write a field in every fdr record associated to a file
|
||||
*/
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static int set_win_fdr_field(struct ti99_lvl2_fileref *l2_file, size_t offset, size_t size, void *data)
|
||||
[[maybe_unused]] static int set_win_fdr_field(struct ti99_lvl2_fileref *l2_file, size_t offset, size_t size, void *data)
|
||||
{
|
||||
win_fdr fdr_buf;
|
||||
unsigned fdr_aphysrec;
|
||||
@ -3316,7 +3313,7 @@ static int set_win_fdr_field(struct ti99_lvl2_fileref *l2_file, size_t offset, s
|
||||
|
||||
for (fdr_aphysrec = l2_file->win.eldestfdr_aphysrec;
|
||||
fdr_aphysrec && ((errorcode = (read_absolute_physrec(&l2_file->win.l2_img->l1_img, fdr_aphysrec, &fdr_buf) ? IMGTOOLERR_READERROR : 0)) == 0);
|
||||
fdr_aphysrec = get_win_fdr_nextsibFDR_physrec(l2_file->win.l2_img, &fdr_buf))
|
||||
fdr_aphysrec = get_win_fdr_nextsibFDR_aphysrec(l2_file->win.l2_img, &fdr_buf))
|
||||
{
|
||||
memcpy(((uint8_t *) &fdr_buf) + offset, data, size);
|
||||
if (write_absolute_physrec(&l2_file->win.l2_img->l1_img, fdr_aphysrec, &fdr_buf))
|
||||
@ -3328,7 +3325,6 @@ static int set_win_fdr_field(struct ti99_lvl2_fileref *l2_file, size_t offset, s
|
||||
|
||||
return errorcode;
|
||||
}
|
||||
#endif
|
||||
|
||||
static uint8_t get_file_flags(struct ti99_lvl2_fileref *l2_file)
|
||||
{
|
||||
@ -3678,11 +3674,10 @@ static void set_file_update_date(struct ti99_lvl2_fileref *l2_file, ti99_date_ti
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static void current_date_time(ti99_date_time *reply)
|
||||
[[maybe_unused]] static void current_date_time(ti99_date_time *reply)
|
||||
{
|
||||
/* All these functions should be ANSI */
|
||||
time_t cur_time = time(NULL);
|
||||
time_t cur_time = time(nullptr);
|
||||
struct tm expanded_time = *localtime(& cur_time);
|
||||
|
||||
reply->time_MSB = (expanded_time.tm_hour << 3) | (expanded_time.tm_min >> 3);
|
||||
@ -3690,7 +3685,6 @@ static void current_date_time(ti99_date_time *reply)
|
||||
reply->date_MSB = ((expanded_time.tm_year % 100) << 1) | ((expanded_time.tm_mon+1) >> 3);
|
||||
reply->date_LSB = ((expanded_time.tm_mon+1) << 5) | expanded_time.tm_mday;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#pragma mark -
|
||||
@ -3715,14 +3709,13 @@ struct ti99_lvl3_fileref
|
||||
int cur_pos_in_phys_rec;
|
||||
};
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/*
|
||||
Open a file on level 3.
|
||||
|
||||
To open a file on level 3, you must open (or create) the file on level 2,
|
||||
then pass the file reference to open_file_lvl3.
|
||||
*/
|
||||
static int open_file_lvl3(ti99_lvl3_fileref *l3_file)
|
||||
[[maybe_unused]] static int open_file_lvl3(ti99_lvl3_fileref *l3_file)
|
||||
{
|
||||
l3_file->cur_log_rec = 0;
|
||||
l3_file->cur_phys_rec = 0;
|
||||
@ -3757,7 +3750,7 @@ static int is_eof(ti99_lvl3_fileref *l3_file)
|
||||
/*
|
||||
Read next record from a file
|
||||
*/
|
||||
static int read_next_record(ti99_lvl3_fileref *l3_file, void *dest, int *out_reclen)
|
||||
[[maybe_unused]] static int read_next_record(ti99_lvl3_fileref *l3_file, void *dest, int *out_reclen)
|
||||
{
|
||||
int errorcode;
|
||||
uint8_t physrec_buf[256];
|
||||
@ -3827,7 +3820,6 @@ static int read_next_record(ti99_lvl3_fileref *l3_file, void *dest, int *out_rec
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
#pragma mark -
|
||||
|
@ -400,11 +400,9 @@ static imgtoolerr_t ti990_image_beginenum(imgtool::directory &enumeration, const
|
||||
static imgtoolerr_t ti990_image_nextenum(imgtool::directory &enumeration, imgtool_dirent &ent);
|
||||
static void ti990_image_closeenum(imgtool::directory &enumeration);
|
||||
static imgtoolerr_t ti990_image_freespace(imgtool::partition &partition, uint64_t *size);
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static imgtoolerr_t ti990_image_readfile(imgtool::partition &partition, const char *fpath, imgtool::stream *destf);
|
||||
static imgtoolerr_t ti990_image_writefile(imgtool::partition &partition, const char *fpath, imgtool::stream *sourcef, util::option_resolution *writeoptions);
|
||||
static imgtoolerr_t ti990_image_deletefile(imgtool::partition &partition, const char *fpath);
|
||||
#endif
|
||||
[[maybe_unused]] static imgtoolerr_t ti990_image_readfile(imgtool::partition &partition, const char *fpath, imgtool::stream *destf);
|
||||
[[maybe_unused]] static imgtoolerr_t ti990_image_writefile(imgtool::partition &partition, const char *fpath, imgtool::stream *sourcef, util::option_resolution *writeoptions);
|
||||
[[maybe_unused]] static imgtoolerr_t ti990_image_deletefile(imgtool::partition &partition, const char *fpath);
|
||||
static imgtoolerr_t ti990_image_create(imgtool::image &image, imgtool::stream::ptr &&stream, util::option_resolution *createoptions);
|
||||
|
||||
enum
|
||||
@ -454,11 +452,10 @@ void ti990_get_info(const imgtool_class *imgclass, uint32_t state, union imgtool
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/*
|
||||
Convert a C string to a 8-character file name (padded with spaces if necessary)
|
||||
*/
|
||||
static void str_to_fname(char dst[8], const char *src)
|
||||
[[maybe_unused]] static void str_to_fname(char dst[8], const char *src)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -480,7 +477,6 @@ static void str_to_fname(char dst[8], const char *src)
|
||||
i++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Convert a 8-character file name to a C string (removing trailing spaces if necessary)
|
||||
@ -557,7 +553,6 @@ static int read_sector_physical_len(imgtool::stream &file_handle, const ti990_ph
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/*
|
||||
Read one sector from a disk image
|
||||
|
||||
@ -566,11 +561,10 @@ static int read_sector_physical_len(imgtool::stream &file_handle, const ti990_ph
|
||||
geometry: disk geometry (sectors per track, tracks per side, sides)
|
||||
dest: pointer to a destination buffer of geometry->bytes_per_sector bytes
|
||||
*/
|
||||
static int read_sector_physical(imgtool::stream *file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, void *dest)
|
||||
[[maybe_unused]] static int read_sector_physical(imgtool::stream &file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, void *dest)
|
||||
{
|
||||
return read_sector_physical_len(file_handle, address, geometry, dest, geometry->bytes_per_sector);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Write one sector to a disk image
|
||||
@ -608,7 +602,6 @@ static int write_sector_physical_len(imgtool::stream &file_handle, const ti990_p
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/*
|
||||
Write one sector to a disk image
|
||||
|
||||
@ -617,11 +610,10 @@ static int write_sector_physical_len(imgtool::stream &file_handle, const ti990_p
|
||||
geometry: disk geometry (sectors per track, tracks per side, sides)
|
||||
dest: pointer to a source buffer of geometry->bytes_per_sector bytes
|
||||
*/
|
||||
static int write_sector_physical(imgtool::stream *file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, const void *src)
|
||||
[[maybe_unused]] static int write_sector_physical(imgtool::stream &file_handle, const ti990_phys_sec_address *address, const ti990_geometry *geometry, const void *src)
|
||||
{
|
||||
return write_sector_physical_len(file_handle, address, geometry, src, geometry->bytes_per_sector);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Convert logical sector address to physical sector address
|
||||
@ -653,7 +645,6 @@ static int read_sector_logical_len(imgtool::stream &file_handle, int secnum, con
|
||||
return read_sector_physical_len(file_handle, &address, geometry, dest, len);
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/*
|
||||
Read one sector from a disk image
|
||||
|
||||
@ -662,11 +653,10 @@ static int read_sector_logical_len(imgtool::stream &file_handle, int secnum, con
|
||||
geometry: disk geometry (sectors per track, tracks per side, sides)
|
||||
dest: pointer to a destination buffer of geometry->bytes_per_sector bytes
|
||||
*/
|
||||
static int read_sector_logical(imgtool::stream *file_handle, int secnum, const ti990_geometry *geometry, void *dest)
|
||||
[[maybe_unused]] static int read_sector_logical(imgtool::stream &file_handle, int secnum, const ti990_geometry *geometry, void *dest)
|
||||
{
|
||||
return read_sector_logical_len(file_handle, secnum, geometry, dest, geometry->bytes_per_sector);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Write one sector to a disk image
|
||||
@ -705,7 +695,6 @@ static int write_sector_logical(imgtool::stream &file_handle, int secnum, const
|
||||
#pragma mark CATALOG FILE ROUTINES
|
||||
#endif
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/*
|
||||
Find the catalog entry and fdr record associated with a file name
|
||||
|
||||
@ -717,7 +706,7 @@ static int write_sector_logical(imgtool::stream &file_handle, int secnum, const
|
||||
out_parent_fdr_secnum: on output, sector offset of the fdr for the parent
|
||||
directory fdr (-1 if root) (may be NULL)
|
||||
*/
|
||||
static int find_fdr(ti990_image *image, const char fpath[MAX_PATH_LEN+1], int *catalog_index, int *out_fdr_secnum, int *out_parent_fdr_secnum)
|
||||
static imgtoolerr_t find_fdr(ti990_image *image, const char fpath[MAX_PATH_LEN+1], int *catalog_index, int *out_fdr_secnum, int *out_parent_fdr_secnum)
|
||||
{
|
||||
int fdr_secnum = -1, parent_fdr_secnum;
|
||||
int i;
|
||||
@ -739,7 +728,7 @@ static int find_fdr(ti990_image *image, const char fpath[MAX_PATH_LEN+1], int *c
|
||||
do
|
||||
{
|
||||
/* read directory header */
|
||||
reply = read_sector_logical_len(image->file_handle, base, & image->geometry, &dor, sizeof(dor));
|
||||
reply = read_sector_logical_len(*image->file_handle, base, & image->geometry, &dor, sizeof(dor));
|
||||
if (reply)
|
||||
return IMGTOOLERR_READERROR;
|
||||
|
||||
@ -767,7 +756,7 @@ static int find_fdr(ti990_image *image, const char fpath[MAX_PATH_LEN+1], int *c
|
||||
i = hash_key;
|
||||
while (1)
|
||||
{
|
||||
reply = read_sector_logical_len(image->file_handle, base + i, & image->geometry,
|
||||
reply = read_sector_logical_len(*image->file_handle, base + i, & image->geometry,
|
||||
& xdr, 0x86);
|
||||
if (reply)
|
||||
return IMGTOOLERR_READERROR;
|
||||
@ -802,7 +791,7 @@ static int find_fdr(ti990_image *image, const char fpath[MAX_PATH_LEN+1], int *c
|
||||
if (flag & fdr_flg_ali)
|
||||
{
|
||||
/* read original fdr */
|
||||
reply = read_sector_logical_len(image->file_handle, base + get_UINT16BE(xdr.adr.raf),
|
||||
reply = read_sector_logical_len(*image->file_handle, base + get_UINT16BE(xdr.adr.raf),
|
||||
& image->geometry, & xdr, 0x86);
|
||||
|
||||
flag = get_UINT16BE(xdr.fdr.flg);
|
||||
@ -837,9 +826,8 @@ static int find_fdr(ti990_image *image, const char fpath[MAX_PATH_LEN+1], int *c
|
||||
if (out_parent_fdr_secnum)
|
||||
*out_parent_fdr_secnum = parent_fdr_secnum;
|
||||
|
||||
return 0;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/*
|
||||
@ -1457,14 +1445,12 @@ static imgtoolerr_t ti990_image_freespace(imgtool::partition &partition, uint64_
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
/*
|
||||
Extract a file from a ti990_image.
|
||||
*/
|
||||
static imgtoolerr_t ti990_image_readfile(imgtool::partition &partition, const char *fpath, imgtool::stream *destf)
|
||||
{
|
||||
imgtool::image *img = &partition->image();
|
||||
ti990_image *image = get_ti990_image(img);
|
||||
ti990_image *image = get_ti990_image(partition.image());
|
||||
int catalog_index, fdr_secnum, parent_fdr_secnum;
|
||||
imgtoolerr_t reply;
|
||||
|
||||
@ -1475,7 +1461,7 @@ static imgtoolerr_t ti990_image_readfile(imgtool::partition &partition, const ch
|
||||
|
||||
/* ... */
|
||||
|
||||
return 0;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
|
||||
#if 0
|
||||
ti99_image *image = (ti99_image*) img;
|
||||
@ -1551,7 +1537,7 @@ static imgtoolerr_t ti990_image_readfile(imgtool::partition &partition, const ch
|
||||
lnks_index++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1560,8 +1546,7 @@ static imgtoolerr_t ti990_image_readfile(imgtool::partition &partition, const ch
|
||||
*/
|
||||
static imgtoolerr_t ti990_image_writefile(imgtool::partition &partition, const char *fpath, imgtool::stream *sourcef, util::option_resolution *writeoptions)
|
||||
{
|
||||
imgtool::image *img = &partition->image();
|
||||
ti990_image *image = get_ti990_image(img);
|
||||
ti990_image *image = get_ti990_image(partition.image());
|
||||
int catalog_index, fdr_secnum, parent_fdr_secnum;
|
||||
imgtoolerr_t reply;
|
||||
|
||||
@ -1573,7 +1558,7 @@ static imgtoolerr_t ti990_image_writefile(imgtool::partition &partition, const c
|
||||
|
||||
/* ... */
|
||||
|
||||
return 0;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
|
||||
#if 0
|
||||
ti99_image *image = (ti99_image*) img;
|
||||
@ -1675,7 +1660,7 @@ static imgtoolerr_t ti990_image_writefile(imgtool::partition &partition, const c
|
||||
if (write_sector_logical(image->file_handle, 0, & image->geometry, &image->sec0))
|
||||
return IMGTOOLERR_WRITEERROR;
|
||||
|
||||
return 0;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -1684,8 +1669,7 @@ static imgtoolerr_t ti990_image_writefile(imgtool::partition &partition, const c
|
||||
*/
|
||||
static imgtoolerr_t ti990_image_deletefile(imgtool::partition &partition, const char *fpath)
|
||||
{
|
||||
imgtool::image *img = &partition->image();
|
||||
ti990_image *image = get_ti990_image(img);
|
||||
ti990_image *image = get_ti990_image(partition.image());
|
||||
int catalog_index, fdr_secnum, parent_fdr_secnum;
|
||||
imgtoolerr_t reply;
|
||||
|
||||
@ -1696,7 +1680,7 @@ static imgtoolerr_t ti990_image_deletefile(imgtool::partition &partition, const
|
||||
|
||||
/* ... */
|
||||
|
||||
return 0;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
|
||||
#if 0
|
||||
ti99_image *image = (ti99_image*) img;
|
||||
@ -1764,10 +1748,9 @@ static imgtoolerr_t ti990_image_deletefile(imgtool::partition &partition, const
|
||||
if (write_sector_logical(image->file_handle, 0, & image->geometry, &image->sec0))
|
||||
return IMGTOOLERR_WRITEERROR;
|
||||
|
||||
return 0;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
Create a blank ti990_image.
|
||||
|
Loading…
Reference in New Issue
Block a user