mirror of
https://github.com/holub/mame
synced 2025-04-21 07:52:35 +03:00
Merge pull request #1494 from npwoods/imgtool_cplusplus_partition
[Imgtool] C++-ified a few more classes
This commit is contained in:
commit
cbbf3665f6
@ -69,7 +69,7 @@ struct basictokens
|
||||
-------------------------------------------------*/
|
||||
|
||||
static imgtoolerr_t basic_readfile(const basictokens *tokens,
|
||||
imgtool_partition *partition, const char *filename,
|
||||
imgtool::partition *partition, const char *filename,
|
||||
const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
@ -91,7 +91,7 @@ static imgtoolerr_t basic_readfile(const basictokens *tokens,
|
||||
}
|
||||
|
||||
/* read actual file */
|
||||
err = imgtool_partition_read_file(partition, filename, fork, mem_stream, nullptr);
|
||||
err = partition->read_file(filename, fork, mem_stream, nullptr);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
@ -174,7 +174,7 @@ done:
|
||||
-------------------------------------------------*/
|
||||
|
||||
static imgtoolerr_t basic_writefile(const basictokens *tokens,
|
||||
imgtool_partition *partition, const char *filename,
|
||||
imgtool::partition *partition, const char *filename,
|
||||
const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
@ -343,7 +343,7 @@ static imgtoolerr_t basic_writefile(const basictokens *tokens,
|
||||
}
|
||||
|
||||
/* write actual file */
|
||||
err = imgtool_partition_write_file(partition, filename, fork, mem_stream, opts, nullptr);
|
||||
err = partition->write_file(filename, fork, mem_stream, opts, nullptr);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
@ -2958,13 +2958,13 @@ static const basictokens cocobas_tokens =
|
||||
ARRAY_LENGTH(cocobas_tokenents)
|
||||
};
|
||||
|
||||
static imgtoolerr_t cocobas_readfile(imgtool_partition *partition, const char *filename,
|
||||
static imgtoolerr_t cocobas_readfile(imgtool::partition *partition, const char *filename,
|
||||
const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
return basic_readfile(&cocobas_tokens, partition, filename, fork, destf);
|
||||
}
|
||||
|
||||
static imgtoolerr_t cocobas_writefile(imgtool_partition *partition, const char *filename,
|
||||
static imgtoolerr_t cocobas_writefile(imgtool::partition *partition, const char *filename,
|
||||
const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
return basic_writefile(&cocobas_tokens, partition, filename, fork, sourcef, opts);
|
||||
@ -3002,13 +3002,13 @@ static const basictokens dragonbas_tokens =
|
||||
ARRAY_LENGTH(dragonbas_tokenents)
|
||||
};
|
||||
|
||||
static imgtoolerr_t dragonbas_readfile(imgtool_partition *partition, const char *filename,
|
||||
static imgtoolerr_t dragonbas_readfile(imgtool::partition *partition, const char *filename,
|
||||
const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
return basic_readfile(&dragonbas_tokens, partition, filename, fork, destf);
|
||||
}
|
||||
|
||||
static imgtoolerr_t dragonbas_writefile(imgtool_partition *partition, const char *filename,
|
||||
static imgtoolerr_t dragonbas_writefile(imgtool::partition *partition, const char *filename,
|
||||
const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
return basic_writefile(&dragonbas_tokens, partition, filename, fork, sourcef, opts);
|
||||
@ -3047,13 +3047,13 @@ static const basictokens vzbas_tokens =
|
||||
ARRAY_LENGTH(vzbas_tokenents)
|
||||
};
|
||||
|
||||
static imgtoolerr_t vzbas_readfile(imgtool_partition *partition, const char *filename,
|
||||
static imgtoolerr_t vzbas_readfile(imgtool::partition *partition, const char *filename,
|
||||
const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
return basic_readfile(&vzbas_tokens, partition, filename, fork, destf);
|
||||
}
|
||||
|
||||
static imgtoolerr_t vzbas_writefile(imgtool_partition *partition, const char *filename,
|
||||
static imgtoolerr_t vzbas_writefile(imgtool::partition *partition, const char *filename,
|
||||
const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
return basic_writefile(&vzbas_tokens, partition, filename, fork, sourcef, opts);
|
||||
@ -3091,13 +3091,13 @@ static const basictokens bml3bas_tokens =
|
||||
ARRAY_LENGTH(bml3bas_tokenents)
|
||||
};
|
||||
|
||||
static imgtoolerr_t bml3bas_readfile(imgtool_partition *partition, const char *filename,
|
||||
static imgtoolerr_t bml3bas_readfile(imgtool::partition *partition, const char *filename,
|
||||
const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
return basic_readfile(&bml3bas_tokens, partition, filename, fork, destf);
|
||||
}
|
||||
|
||||
static imgtoolerr_t bml3bas_writefile(imgtool_partition *partition, const char *filename,
|
||||
static imgtoolerr_t bml3bas_writefile(imgtool::partition *partition, const char *filename,
|
||||
const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
return basic_writefile(&bml3bas_tokens, partition, filename, fork, sourcef, opts);
|
||||
|
@ -53,7 +53,7 @@ static imgtoolerr_t convert_stream_eolns(imgtool_stream *source, imgtool_stream
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t ascii_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t ascii_readfile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool_stream *mem_stream;
|
||||
@ -65,7 +65,7 @@ static imgtoolerr_t ascii_readfile(imgtool_partition *partition, const char *fil
|
||||
goto done;
|
||||
}
|
||||
|
||||
err = imgtool_partition_read_file(partition, filename, fork, mem_stream, nullptr);
|
||||
err = partition->read_file(filename, fork, mem_stream, nullptr);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
@ -82,7 +82,7 @@ done:
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t ascii_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
static imgtoolerr_t ascii_writefile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool_stream *mem_stream = nullptr;
|
||||
@ -96,14 +96,14 @@ static imgtoolerr_t ascii_writefile(imgtool_partition *partition, const char *fi
|
||||
goto done;
|
||||
}
|
||||
|
||||
eoln = imgtool_partition_get_info_string(partition, IMGTOOLINFO_STR_EOLN);
|
||||
eoln = partition->get_info_string(IMGTOOLINFO_STR_EOLN);
|
||||
|
||||
err = convert_stream_eolns(sourcef, mem_stream, eoln);
|
||||
if (err)
|
||||
goto done;
|
||||
stream_seek(mem_stream, SEEK_SET, 0);
|
||||
|
||||
err = imgtool_partition_write_file(partition, filename, fork, mem_stream, opts, nullptr);
|
||||
err = partition->write_file(filename, fork, mem_stream, opts, nullptr);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -133,56 +133,132 @@ namespace imgtool
|
||||
};
|
||||
}
|
||||
|
||||
/* ----- partition management ----- */
|
||||
imgtoolerr_t imgtool_partition_open(imgtool::image *image, int partition_index, imgtool_partition **partition);
|
||||
void imgtool_partition_close(imgtool_partition *partition);
|
||||
imgtool::image *imgtool_partition_image(imgtool_partition *partition);
|
||||
namespace imgtool
|
||||
{
|
||||
// ----- partition management -----
|
||||
class partition
|
||||
{
|
||||
friend class directory;
|
||||
public:
|
||||
typedef std::unique_ptr<partition> ptr;
|
||||
|
||||
/* ----- partition operations ----- */
|
||||
imgtoolerr_t imgtool_partition_get_directory_entry(imgtool_partition *partition, const char *path, int index, imgtool_dirent *ent);
|
||||
imgtoolerr_t imgtool_partition_get_file_size(imgtool_partition *partition, const char *filename, UINT64 *filesize);
|
||||
imgtoolerr_t imgtool_partition_get_free_space(imgtool_partition *partition, UINT64 *sz);
|
||||
imgtoolerr_t imgtool_partition_read_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf, filter_getinfoproc filter);
|
||||
imgtoolerr_t imgtool_partition_write_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *resolution, filter_getinfoproc filter);
|
||||
imgtoolerr_t imgtool_partition_get_file(imgtool_partition *partition, const char *filename, const char *fork, const char *dest, filter_getinfoproc filter);
|
||||
imgtoolerr_t imgtool_partition_put_file(imgtool_partition *partition, const char *newfname, const char *fork, const char *source, util::option_resolution *opts, filter_getinfoproc filter);
|
||||
imgtoolerr_t imgtool_partition_delete_file(imgtool_partition *partition, const char *fname);
|
||||
imgtoolerr_t imgtool_partition_list_file_forks(imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len);
|
||||
imgtoolerr_t imgtool_partition_create_directory(imgtool_partition *partition, const char *path);
|
||||
imgtoolerr_t imgtool_partition_delete_directory(imgtool_partition *partition, const char *path);
|
||||
imgtoolerr_t imgtool_partition_list_file_attributes(imgtool_partition *partition, const char *path, UINT32 *attrs, size_t len);
|
||||
imgtoolerr_t imgtool_partition_get_file_attributes(imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values);
|
||||
imgtoolerr_t imgtool_partition_put_file_attributes(imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values);
|
||||
imgtoolerr_t imgtool_partition_get_file_attribute(imgtool_partition *partition, const char *path, UINT32 attr, imgtool_attribute *value);
|
||||
imgtoolerr_t imgtool_partition_put_file_attribute(imgtool_partition *partition, const char *path, UINT32 attr, imgtool_attribute value);
|
||||
void imgtool_partition_get_attribute_name(imgtool_partition *partition, UINT32 attribute, const imgtool_attribute *attr_value, char *buffer, size_t buffer_len);
|
||||
imgtoolerr_t imgtool_partition_get_icon_info(imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo);
|
||||
imgtoolerr_t imgtool_partition_suggest_file_filters(imgtool_partition *partition, const char *path, imgtool_stream *stream, imgtool_transfer_suggestion *suggestions, size_t suggestions_length);
|
||||
imgtoolerr_t imgtool_partition_get_block_size(imgtool_partition *partition, UINT32 &length);
|
||||
imgtoolerr_t imgtool_partition_read_block(imgtool_partition *partition, UINT64 block, void *buffer);
|
||||
imgtoolerr_t imgtool_partition_write_block(imgtool_partition *partition, UINT64 block, const void *buffer);
|
||||
imgtoolerr_t imgtool_partition_get_chain(imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size);
|
||||
imgtoolerr_t imgtool_partition_get_chain_string(imgtool_partition *partition, const char *path, char *buffer, size_t buffer_len);
|
||||
imgtool_partition_features imgtool_partition_get_features(imgtool_partition *partition);
|
||||
void * imgtool_partition_get_info_ptr(imgtool_partition *partition, UINT32 state);
|
||||
const char * imgtool_partition_get_info_string(imgtool_partition *partition, UINT32 state);
|
||||
UINT64 imgtool_partition_get_info_int(imgtool_partition *partition, UINT32 state);
|
||||
void * imgtool_partition_extra_bytes(imgtool_partition *partition);
|
||||
UINT64 imgtool_partition_rand(imgtool_partition *partition);
|
||||
// ctor/dtor
|
||||
partition(imgtool::image &image, imgtool_class &imgclass, int partition_index, UINT64 base_block, UINT64 block_count);
|
||||
~partition();
|
||||
|
||||
/* ----- path management ----- */
|
||||
const char * imgtool_partition_get_root_path(imgtool_partition *partition);
|
||||
const char * imgtool_partition_path_concatenate(imgtool_partition *partition, const char *path1, const char *path2);
|
||||
const char * imgtool_partition_get_base_name(imgtool_partition *partition, const char *path);
|
||||
static imgtoolerr_t open(imgtool::image &image, int partition_index, ptr &partition);
|
||||
image &image() { return m_image; }
|
||||
|
||||
/* ----- directory management ----- */
|
||||
imgtoolerr_t imgtool_directory_open(imgtool_partition *partition, const char *path, imgtool_directory **outenum);
|
||||
void imgtool_directory_close(imgtool_directory *enumeration);
|
||||
imgtoolerr_t imgtool_directory_get_next(imgtool_directory *enumeration, imgtool_dirent *ent);
|
||||
const imgtool_module *imgtool_directory_module(imgtool_directory *enumeration);
|
||||
void *imgtool_directory_extrabytes(imgtool_directory *enumeration);
|
||||
imgtool_partition *imgtool_directory_partition(imgtool_directory *directory);
|
||||
imgtool::image *imgtool_directory_image(imgtool_directory *enumeration);
|
||||
// ----- partition operations -----
|
||||
imgtoolerr_t get_directory_entry(const char *path, int index, imgtool_dirent &ent);
|
||||
imgtoolerr_t get_file_size(const char *filename, UINT64 &filesize);
|
||||
imgtoolerr_t get_free_space(UINT64 &sz);
|
||||
imgtoolerr_t read_file(const char *filename, const char *fork, imgtool_stream *destf, filter_getinfoproc filter);
|
||||
imgtoolerr_t write_file(const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *resolution, filter_getinfoproc filter);
|
||||
imgtoolerr_t get_file(const char *filename, const char *fork, const char *dest, filter_getinfoproc filter);
|
||||
imgtoolerr_t put_file(const char *newfname, const char *fork, const char *source, util::option_resolution *opts, filter_getinfoproc filter);
|
||||
imgtoolerr_t delete_file(const char *fname);
|
||||
imgtoolerr_t list_file_forks(const char *path, imgtool_forkent *ents, size_t len);
|
||||
imgtoolerr_t create_directory(const char *path);
|
||||
imgtoolerr_t delete_directory(const char *path);
|
||||
imgtoolerr_t list_file_attributes(const char *path, UINT32 *attrs, size_t len);
|
||||
imgtoolerr_t get_file_attributes(const char *path, const UINT32 *attrs, imgtool_attribute *values);
|
||||
imgtoolerr_t put_file_attributes(const char *path, const UINT32 *attrs, const imgtool_attribute *values);
|
||||
imgtoolerr_t get_file_attribute(const char *path, UINT32 attr, imgtool_attribute &value);
|
||||
imgtoolerr_t put_file_attribute(const char *path, UINT32 attr, const imgtool_attribute &value);
|
||||
void get_attribute_name(UINT32 attribute, const imgtool_attribute *attr_value, char *buffer, size_t buffer_len);
|
||||
imgtoolerr_t get_icon_info(const char *path, imgtool_iconinfo *iconinfo);
|
||||
imgtoolerr_t suggest_file_filters(const char *path, imgtool_stream *stream, imgtool_transfer_suggestion *suggestions, size_t suggestions_length);
|
||||
imgtoolerr_t get_block_size(UINT32 &length);
|
||||
imgtoolerr_t read_block(UINT64 block, void *buffer);
|
||||
imgtoolerr_t write_block(UINT64 block, const void *buffer);
|
||||
imgtoolerr_t get_chain(const char *path, imgtool_chainent *chain, size_t chain_size);
|
||||
imgtoolerr_t get_chain_string(const char *path, char *buffer, size_t buffer_len);
|
||||
imgtool_partition_features get_features() const;
|
||||
void * get_info_ptr(UINT32 state);
|
||||
const char * get_info_string(UINT32 state);
|
||||
UINT64 get_info_int(UINT32 state);
|
||||
void * extra_bytes();
|
||||
|
||||
// ----- path management -----
|
||||
const char * get_root_path();
|
||||
const char * path_concatenate(const char *path1, const char *path2);
|
||||
const char * get_base_name(const char *path);
|
||||
|
||||
private:
|
||||
imgtool::image &m_image;
|
||||
int m_partition_index;
|
||||
UINT64 m_base_block;
|
||||
UINT64 m_block_count;
|
||||
|
||||
imgtool_class m_imgclass;
|
||||
size_t m_partition_extra_bytes;
|
||||
size_t m_directory_extra_bytes;
|
||||
|
||||
char m_path_separator;
|
||||
char m_alternate_path_separator;
|
||||
|
||||
unsigned int m_prefer_ucase : 1;
|
||||
unsigned int m_supports_creation_time : 1;
|
||||
unsigned int m_supports_lastmodified_time : 1;
|
||||
unsigned int m_supports_bootblock : 1; /* this module supports loading/storing the boot block */
|
||||
|
||||
imgtoolerr_t(*m_begin_enum) (imgtool::directory *enumeration, const char *path);
|
||||
imgtoolerr_t(*m_next_enum) (imgtool::directory *enumeration, imgtool_dirent *ent);
|
||||
void(*m_close_enum) (imgtool::directory *enumeration);
|
||||
imgtoolerr_t(*m_free_space) (imgtool::partition *partition, UINT64 *size);
|
||||
imgtoolerr_t(*m_read_file) (imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf);
|
||||
imgtoolerr_t(*m_write_file) (imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts);
|
||||
imgtoolerr_t(*m_delete_file) (imgtool::partition *partition, const char *filename);
|
||||
imgtoolerr_t(*m_list_forks) (imgtool::partition *partition, const char *path, imgtool_forkent *ents, size_t len);
|
||||
imgtoolerr_t(*m_create_dir) (imgtool::partition *partition, const char *path);
|
||||
imgtoolerr_t(*m_delete_dir) (imgtool::partition *partition, const char *path);
|
||||
imgtoolerr_t(*m_list_attrs) (imgtool::partition *partition, const char *path, UINT32 *attrs, size_t len);
|
||||
imgtoolerr_t(*m_get_attrs) (imgtool::partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values);
|
||||
imgtoolerr_t(*m_set_attrs) (imgtool::partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values);
|
||||
imgtoolerr_t(*m_attr_name) (UINT32 attribute, const imgtool_attribute *attr, char *buffer, size_t buffer_len);
|
||||
imgtoolerr_t(*m_get_iconinfo) (imgtool::partition *partition, const char *path, imgtool_iconinfo *iconinfo);
|
||||
imgtoolerr_t(*m_suggest_transfer)(imgtool::partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length);
|
||||
imgtoolerr_t(*m_get_chain) (imgtool::partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size);
|
||||
|
||||
const util::option_guide *m_writefile_optguide;
|
||||
std::string m_writefile_optspec;
|
||||
|
||||
std::unique_ptr<UINT8[]> m_extra_bytes;
|
||||
|
||||
// methods
|
||||
imgtoolerr_t cannonicalize_path(UINT32 flags, const char **path, char **alloc_path);
|
||||
imgtoolerr_t cannonicalize_fork(const char **fork);
|
||||
char *normalize_filename(const char *src);
|
||||
imgtoolerr_t map_block_to_image_block(UINT64 partition_block, UINT64 &image_block) const;
|
||||
};
|
||||
|
||||
// ----- directory management -----
|
||||
class directory
|
||||
{
|
||||
public:
|
||||
typedef std::unique_ptr<directory> ptr;
|
||||
|
||||
// ctor/dtor
|
||||
directory(imgtool::partition &partition);
|
||||
~directory();
|
||||
|
||||
// methods
|
||||
static imgtoolerr_t open(imgtool::partition &partition, const char *path, ptr &outenum);
|
||||
imgtoolerr_t get_next(imgtool_dirent &ent);
|
||||
|
||||
// accessors
|
||||
imgtool::partition &partition() { return m_partition; }
|
||||
imgtool::image &image() { return partition().image(); }
|
||||
const imgtool_module &module() { return partition().image().module(); }
|
||||
void *extra_bytes() { assert(m_extra_bytes); return m_extra_bytes.get(); }
|
||||
|
||||
private:
|
||||
imgtool::partition &m_partition;
|
||||
std::unique_ptr<UINT8[]> m_extra_bytes;
|
||||
bool m_okay_to_close; // similar wart as what is on imgtool::image
|
||||
};
|
||||
};
|
||||
|
||||
/* ----- special ----- */
|
||||
int imgtool_validitychecks(void);
|
||||
|
@ -30,11 +30,10 @@
|
||||
namespace imgtool
|
||||
{
|
||||
class image;
|
||||
class partition;
|
||||
class directory;
|
||||
};
|
||||
|
||||
struct imgtool_partition;
|
||||
struct imgtool_directory;
|
||||
|
||||
enum imgtool_suggestion_viability_t
|
||||
{
|
||||
SUGGESTION_END,
|
||||
@ -49,8 +48,8 @@ union filterinfo
|
||||
void * f; /* generic function pointers */
|
||||
const char *s; /* generic strings */
|
||||
|
||||
imgtoolerr_t (*read_file)(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf);
|
||||
imgtoolerr_t (*write_file)(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts);
|
||||
imgtoolerr_t (*read_file)(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf);
|
||||
imgtoolerr_t (*write_file)(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts);
|
||||
imgtoolerr_t (*check_stream)(imgtool_stream *stream, imgtool_suggestion_viability_t *viability);
|
||||
};
|
||||
|
||||
@ -260,24 +259,24 @@ union imgtoolinfo
|
||||
imgtoolerr_t (*create) (imgtool::image *image, imgtool_stream *stream, util::option_resolution *opts);
|
||||
imgtoolerr_t (*create_partition) (imgtool::image *image, UINT64 first_block, UINT64 block_count);
|
||||
void (*info) (imgtool::image *image, char *string, size_t len);
|
||||
imgtoolerr_t (*begin_enum) (imgtool_directory *enumeration, const char *path);
|
||||
imgtoolerr_t (*next_enum) (imgtool_directory *enumeration, imgtool_dirent *ent);
|
||||
void (*close_enum) (imgtool_directory *enumeration);
|
||||
imgtoolerr_t (*open_partition) (imgtool_partition *partition, UINT64 first_block, UINT64 block_count);
|
||||
imgtoolerr_t (*free_space) (imgtool_partition *partition, UINT64 *size);
|
||||
imgtoolerr_t (*read_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf);
|
||||
imgtoolerr_t (*write_file) (imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts);
|
||||
imgtoolerr_t (*delete_file) (imgtool_partition *partition, const char *filename);
|
||||
imgtoolerr_t (*list_forks) (imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len);
|
||||
imgtoolerr_t (*create_dir) (imgtool_partition *partition, const char *path);
|
||||
imgtoolerr_t (*delete_dir) (imgtool_partition *partition, const char *path);
|
||||
imgtoolerr_t (*list_attrs) (imgtool_partition *partition, const char *path, UINT32 *attrs, size_t len);
|
||||
imgtoolerr_t (*get_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values);
|
||||
imgtoolerr_t (*set_attrs) (imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values);
|
||||
imgtoolerr_t (*begin_enum) (imgtool::directory *enumeration, const char *path);
|
||||
imgtoolerr_t (*next_enum) (imgtool::directory *enumeration, imgtool_dirent *ent);
|
||||
void (*close_enum) (imgtool::directory *enumeration);
|
||||
imgtoolerr_t (*open_partition) (imgtool::partition *partition, UINT64 first_block, UINT64 block_count);
|
||||
imgtoolerr_t (*free_space) (imgtool::partition *partition, UINT64 *size);
|
||||
imgtoolerr_t (*read_file) (imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf);
|
||||
imgtoolerr_t (*write_file) (imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts);
|
||||
imgtoolerr_t (*delete_file) (imgtool::partition *partition, const char *filename);
|
||||
imgtoolerr_t (*list_forks) (imgtool::partition *partition, const char *path, imgtool_forkent *ents, size_t len);
|
||||
imgtoolerr_t (*create_dir) (imgtool::partition *partition, const char *path);
|
||||
imgtoolerr_t (*delete_dir) (imgtool::partition *partition, const char *path);
|
||||
imgtoolerr_t (*list_attrs) (imgtool::partition *partition, const char *path, UINT32 *attrs, size_t len);
|
||||
imgtoolerr_t (*get_attrs) (imgtool::partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values);
|
||||
imgtoolerr_t (*set_attrs) (imgtool::partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values);
|
||||
imgtoolerr_t (*attr_name) (UINT32 attribute, const imgtool_attribute *attr, char *buffer, size_t buffer_len);
|
||||
imgtoolerr_t (*get_iconinfo) (imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo);
|
||||
imgtoolerr_t (*suggest_transfer) (imgtool_partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length);
|
||||
imgtoolerr_t (*get_chain) (imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size);
|
||||
imgtoolerr_t (*get_iconinfo) (imgtool::partition *partition, const char *path, imgtool_iconinfo *iconinfo);
|
||||
imgtoolerr_t (*suggest_transfer) (imgtool::partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length);
|
||||
imgtoolerr_t (*get_chain) (imgtool::partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size);
|
||||
imgtoolerr_t (*get_geometry) (imgtool::image *image, UINT32 *tracks, UINT32 *heads, UINT32 *sectors);
|
||||
imgtoolerr_t (*read_sector) (imgtool::image *image, UINT32 track, UINT32 head, UINT32 sector, std::vector<UINT8> &buffer);
|
||||
imgtoolerr_t (*write_sector) (imgtool::image *image, UINT32 track, UINT32 head, UINT32 sector, const void *buffer, size_t len, int ddam);
|
||||
|
@ -174,8 +174,8 @@ static int cmd_dir(const struct command *c, int argc, char *argv[])
|
||||
int total_count, total_size, freespace_err;
|
||||
UINT64 freespace;
|
||||
imgtool::image::ptr image;
|
||||
imgtool_partition *partition = nullptr;
|
||||
imgtool_directory *imgenum = nullptr;
|
||||
imgtool::partition::ptr partition;
|
||||
imgtool::directory::ptr imgenum;
|
||||
imgtool_dirent ent;
|
||||
char buf[512];
|
||||
char last_modified[19];
|
||||
@ -188,13 +188,13 @@ static int cmd_dir(const struct command *c, int argc, char *argv[])
|
||||
goto done;
|
||||
|
||||
/* attempt to open partition */
|
||||
err = imgtool_partition_open(image.get(), partition_index, &partition);
|
||||
err = imgtool::partition::open(*image, partition_index, partition);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
path = argc > 2 ? argv[2] : nullptr;
|
||||
|
||||
err = imgtool_directory_open(partition, path, &imgenum);
|
||||
err = imgtool::directory::open(*partition, path, imgenum);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
@ -210,7 +210,7 @@ static int cmd_dir(const struct command *c, int argc, char *argv[])
|
||||
fprintf(stdout, "%s\n", buf);
|
||||
fprintf(stdout, "------------------------------ -------- --------------- ------------------\n");
|
||||
|
||||
while (((err = imgtool_directory_get_next(imgenum, &ent)) == 0) && !ent.eof)
|
||||
while (((err = imgenum->get_next(ent)) == 0) && !ent.eof)
|
||||
{
|
||||
if (ent.directory)
|
||||
snprintf(buf, sizeof(buf), "<DIR>");
|
||||
@ -238,7 +238,7 @@ static int cmd_dir(const struct command *c, int argc, char *argv[])
|
||||
memset(&ent, 0, sizeof(ent));
|
||||
}
|
||||
|
||||
freespace_err = imgtool_partition_get_free_space(partition, &freespace);
|
||||
freespace_err = partition->get_free_space(freespace);
|
||||
|
||||
if (err)
|
||||
goto done;
|
||||
@ -249,10 +249,6 @@ static int cmd_dir(const struct command *c, int argc, char *argv[])
|
||||
fprintf(stdout, " %8u bytes free\n", (unsigned int) freespace);
|
||||
|
||||
done:
|
||||
if (imgenum)
|
||||
imgtool_directory_close(imgenum);
|
||||
if (partition)
|
||||
imgtool_partition_close(partition);
|
||||
if (err)
|
||||
reporterror(err, c, argv[0], argv[1], nullptr, nullptr, nullptr);
|
||||
return err ? -1 : 0;
|
||||
@ -263,8 +259,8 @@ done:
|
||||
static int cmd_get(const struct command *c, int argc, char *argv[])
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
std::unique_ptr<imgtool::image> image;
|
||||
imgtool_partition *partition = nullptr;
|
||||
imgtool::image::ptr image;
|
||||
imgtool::partition::ptr partition;
|
||||
const char *filename;
|
||||
char *new_filename;
|
||||
int unnamedargs = 0;
|
||||
@ -276,7 +272,7 @@ static int cmd_get(const struct command *c, int argc, char *argv[])
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
err = imgtool_partition_open(image.get(), partition_index, &partition);
|
||||
err = imgtool::partition::open(*image, partition_index, partition);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
@ -288,7 +284,7 @@ static int cmd_get(const struct command *c, int argc, char *argv[])
|
||||
|
||||
new_filename = (unnamedargs == 4) ? argv[3] : nullptr;
|
||||
|
||||
err = imgtool_partition_get_file(partition, filename, fork, new_filename, filter);
|
||||
err = partition->get_file(filename, fork, new_filename, filter);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
@ -297,8 +293,6 @@ static int cmd_get(const struct command *c, int argc, char *argv[])
|
||||
done:
|
||||
if (err)
|
||||
reporterror(err, c, argv[0], argv[1], argv[2], argv[3], nullptr);
|
||||
if (partition)
|
||||
imgtool_partition_close(partition);
|
||||
return (err || (unnamedargs < 0)) ? -1 : 0;
|
||||
}
|
||||
|
||||
@ -308,8 +302,8 @@ static int cmd_put(const struct command *c, int argc, char *argv[])
|
||||
{
|
||||
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
|
||||
int i;
|
||||
std::unique_ptr<imgtool::image> image;
|
||||
imgtool_partition *partition = nullptr;
|
||||
imgtool::image::ptr image;
|
||||
imgtool::partition::ptr partition;
|
||||
const char *filename = nullptr;
|
||||
int unnamedargs;
|
||||
filter_getinfoproc filter;
|
||||
@ -341,12 +335,12 @@ static int cmd_put(const struct command *c, int argc, char *argv[])
|
||||
goto done;
|
||||
|
||||
/* open up the partition */
|
||||
err = imgtool_partition_open(image.get(), partition_index, &partition);
|
||||
err = imgtool::partition::open(*image, partition_index, partition);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
writefile_optguide = (const util::option_guide *) imgtool_partition_get_info_ptr(partition, IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE);
|
||||
writefile_optspec = (const char *)imgtool_partition_get_info_ptr(partition, IMGTOOLINFO_STR_WRITEFILE_OPTSPEC);
|
||||
writefile_optguide = (const util::option_guide *) partition->get_info_ptr(IMGTOOLINFO_PTR_WRITEFILE_OPTGUIDE);
|
||||
writefile_optspec = (const char *)partition->get_info_ptr(IMGTOOLINFO_STR_WRITEFILE_OPTSPEC);
|
||||
|
||||
if (writefile_optguide && writefile_optspec)
|
||||
{
|
||||
@ -374,14 +368,12 @@ static int cmd_put(const struct command *c, int argc, char *argv[])
|
||||
{
|
||||
filename = filename_list[i];
|
||||
printf("Putting file '%s'...\n", filename);
|
||||
err = imgtool_partition_put_file(partition, new_filename, fork, filename, resolution.get(), filter);
|
||||
err = partition->put_file(new_filename, fork, filename, resolution.get(), filter);
|
||||
if (err)
|
||||
goto done;
|
||||
}
|
||||
|
||||
done:
|
||||
if (partition)
|
||||
imgtool_partition_close(partition);
|
||||
if (err)
|
||||
reporterror(err, c, argv[0], argv[1], filename, nullptr, resolution.get());
|
||||
return err ? -1 : 0;
|
||||
@ -392,9 +384,9 @@ done:
|
||||
static int cmd_getall(const struct command *c, int argc, char *argv[])
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
std::unique_ptr<imgtool::image> image;
|
||||
imgtool_partition *partition = nullptr;
|
||||
imgtool_directory *imgenum = nullptr;
|
||||
imgtool::image::ptr image;
|
||||
imgtool::partition::ptr partition;
|
||||
imgtool::directory::ptr imgenum;
|
||||
imgtool_dirent ent;
|
||||
filter_getinfoproc filter;
|
||||
int unnamedargs;
|
||||
@ -406,7 +398,7 @@ static int cmd_getall(const struct command *c, int argc, char *argv[])
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
err = imgtool_partition_open(image.get(), partition_index, &partition);
|
||||
err = imgtool::partition::open(*image, partition_index, partition);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
@ -420,26 +412,22 @@ static int cmd_getall(const struct command *c, int argc, char *argv[])
|
||||
if (unnamedargs < 0)
|
||||
goto done;
|
||||
|
||||
err = imgtool_directory_open(partition, path, &imgenum);
|
||||
err = imgtool::directory::open(*partition, path, imgenum);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
memset(&ent, 0, sizeof(ent));
|
||||
|
||||
while (((err = imgtool_directory_get_next(imgenum, &ent)) == 0) && !ent.eof)
|
||||
while (((err = imgenum->get_next(ent)) == 0) && !ent.eof)
|
||||
{
|
||||
fprintf(stdout, "Retrieving %s (%u bytes)\n", ent.filename, (unsigned int) ent.filesize);
|
||||
|
||||
err = imgtool_partition_get_file(partition, ent.filename, nullptr, nullptr, filter);
|
||||
err = partition->get_file(ent.filename, nullptr, nullptr, filter);
|
||||
if (err)
|
||||
goto done;
|
||||
}
|
||||
|
||||
done:
|
||||
if (imgenum)
|
||||
imgtool_directory_close(imgenum);
|
||||
if (partition)
|
||||
imgtool_partition_close(partition);
|
||||
if (err)
|
||||
reporterror(err, c, argv[0], argv[1], nullptr, nullptr, nullptr);
|
||||
return err ? -1 : 0;
|
||||
@ -450,25 +438,23 @@ done:
|
||||
static int cmd_del(const struct command *c, int argc, char *argv[])
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
std::unique_ptr<imgtool::image> image;
|
||||
imgtool_partition *partition = nullptr;
|
||||
imgtool::image::ptr image;
|
||||
imgtool::partition::ptr partition;
|
||||
int partition_index = 0;
|
||||
|
||||
err = imgtool::image::open(argv[0], argv[1], OSD_FOPEN_RW, image);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
err = imgtool_partition_open(image.get(), partition_index, &partition);
|
||||
err = imgtool::partition::open(*image, partition_index, partition);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
err = imgtool_partition_delete_file(partition, argv[2]);
|
||||
err = partition->delete_file(argv[2]);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
done:
|
||||
if (partition)
|
||||
imgtool_partition_close(partition);
|
||||
if (err)
|
||||
reporterror(err, c, argv[0], argv[1], argv[2], nullptr, nullptr);
|
||||
return err ? -1 : 0;
|
||||
@ -479,25 +465,23 @@ done:
|
||||
static int cmd_mkdir(const struct command *c, int argc, char *argv[])
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
std::unique_ptr<imgtool::image> image;
|
||||
imgtool_partition *partition = nullptr;
|
||||
imgtool::image::ptr image;
|
||||
imgtool::partition::ptr partition;
|
||||
int partition_index = 0;
|
||||
|
||||
err = imgtool::image::open(argv[0], argv[1], OSD_FOPEN_RW, image);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
err = imgtool_partition_open(image.get(), partition_index, &partition);
|
||||
err = imgtool::partition::open(*image, partition_index, partition);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
err = imgtool_partition_create_directory(partition, argv[2]);
|
||||
err = partition->create_directory(argv[2]);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
done:
|
||||
if (partition)
|
||||
imgtool_partition_close(partition);
|
||||
if (err)
|
||||
reporterror(err, c, argv[0], argv[1], argv[2], nullptr, nullptr);
|
||||
return err ? -1 : 0;
|
||||
@ -508,25 +492,23 @@ done:
|
||||
static int cmd_rmdir(const struct command *c, int argc, char *argv[])
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
std::unique_ptr<imgtool::image> image;
|
||||
imgtool_partition *partition = nullptr;
|
||||
imgtool::image::ptr image;
|
||||
imgtool::partition::ptr partition;
|
||||
int partition_index = 0;
|
||||
|
||||
err = imgtool::image::open(argv[0], argv[1], OSD_FOPEN_RW, image);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
err = imgtool_partition_open(image.get(), partition_index, &partition);
|
||||
err = imgtool::partition::open(*image, partition_index, partition);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
err = imgtool_partition_delete_directory(partition, argv[2]);
|
||||
err = partition->delete_directory(argv[2]);
|
||||
if (err)
|
||||
goto done;
|
||||
|
||||
done:
|
||||
if (partition)
|
||||
imgtool_partition_close(partition);
|
||||
if (err)
|
||||
reporterror(err, c, argv[0], argv[1], argv[2], nullptr, nullptr);
|
||||
return err ? -1 : 0;
|
||||
|
@ -1845,13 +1845,13 @@ static imgtoolerr_t amiga_image_write_sector(imgtool::image* img, UINT32 track,
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t amiga_image_beginenum(imgtool_directory *enumeration, const char *path)
|
||||
static imgtoolerr_t amiga_image_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
{
|
||||
int blocks = get_total_blocks(imgtool_directory_image(enumeration));
|
||||
int blocks = get_total_blocks(&enumeration->image());
|
||||
imgtoolerr_t ret;
|
||||
amiga_iterator *iter;
|
||||
|
||||
iter = (amiga_iterator *) imgtool_directory_extrabytes(enumeration);
|
||||
iter = (amiga_iterator *) enumeration->extra_bytes();
|
||||
if (!iter) return IMGTOOLERR_OUTOFMEMORY;
|
||||
|
||||
iter->index = 1;
|
||||
@ -1861,7 +1861,7 @@ static imgtoolerr_t amiga_image_beginenum(imgtool_directory *enumeration, const
|
||||
if (path[0])
|
||||
{
|
||||
/* search for the directory block, start with the root block */
|
||||
ret = find_entry(imgtool_directory_image(enumeration), path, blocks/2, &iter->block);
|
||||
ret = find_entry(&enumeration->image(), path, blocks/2, &iter->block);
|
||||
if (ret) return ret;
|
||||
}
|
||||
else
|
||||
@ -1874,9 +1874,9 @@ static imgtoolerr_t amiga_image_beginenum(imgtool_directory *enumeration, const
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t amiga_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t amiga_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
{
|
||||
amiga_iterator *iter = (amiga_iterator *) imgtool_directory_extrabytes(enumeration);
|
||||
amiga_iterator *iter = (amiga_iterator *) enumeration->extra_bytes();
|
||||
imgtoolerr_t ret;
|
||||
UINT32 ht[TSIZE];
|
||||
int block;
|
||||
@ -1889,7 +1889,7 @@ static imgtoolerr_t amiga_image_nextenum(imgtool_directory *enumeration, imgtool
|
||||
}
|
||||
|
||||
/* get hash table */
|
||||
ret = get_hash_table(imgtool_directory_image(enumeration), iter->block, ht);
|
||||
ret = get_hash_table(&enumeration->image(), iter->block, ht);
|
||||
if (ret) return ret;
|
||||
|
||||
/* skip empty hash table entries */
|
||||
@ -1907,14 +1907,14 @@ static imgtoolerr_t amiga_image_nextenum(imgtool_directory *enumeration, imgtool
|
||||
/* get block number */
|
||||
block = (iter->next_block == 0) ? ht[iter->ht_index] : iter->next_block;
|
||||
|
||||
switch (get_block_type(imgtool_directory_image(enumeration), block))
|
||||
switch (get_block_type(&enumeration->image(), block))
|
||||
{
|
||||
case ST_FILE:
|
||||
{
|
||||
file_block file;
|
||||
|
||||
/* get block */
|
||||
ret = read_file_block(imgtool_directory_image(enumeration), block, &file);
|
||||
ret = read_file_block(&enumeration->image(), block, &file);
|
||||
if (ret) return ret;
|
||||
|
||||
/* fill directory entry */
|
||||
@ -1934,7 +1934,7 @@ static imgtoolerr_t amiga_image_nextenum(imgtool_directory *enumeration, imgtool
|
||||
dir_block dir;
|
||||
|
||||
/* get block */
|
||||
ret = read_dir_block(imgtool_directory_image(enumeration), block, &dir);
|
||||
ret = read_dir_block(&enumeration->image(), block, &dir);
|
||||
if (ret) return ret;
|
||||
|
||||
/* fill directory entry */
|
||||
@ -1954,7 +1954,7 @@ static imgtoolerr_t amiga_image_nextenum(imgtool_directory *enumeration, imgtool
|
||||
softlink_block sl;
|
||||
|
||||
/* get block */
|
||||
ret = read_softlink_block(imgtool_directory_image(enumeration), block, &sl);
|
||||
ret = read_softlink_block(&enumeration->image(), block, &sl);
|
||||
if (ret) return ret;
|
||||
|
||||
/* fill directory entry */
|
||||
@ -1978,14 +1978,14 @@ static imgtoolerr_t amiga_image_nextenum(imgtool_directory *enumeration, imgtool
|
||||
hardlink_block hl;
|
||||
|
||||
/* get block */
|
||||
ret = read_hardlink_block(imgtool_directory_image(enumeration), block, &hl);
|
||||
ret = read_hardlink_block(&enumeration->image(), block, &hl);
|
||||
if (ret) return ret;
|
||||
|
||||
/* get filesize from linked file */
|
||||
if (!ent->directory)
|
||||
{
|
||||
file_block file;
|
||||
ret = read_file_block(imgtool_directory_image(enumeration), hl.real_entry, &file);
|
||||
ret = read_file_block(&enumeration->image(), hl.real_entry, &file);
|
||||
if (ret) return ret;
|
||||
ent->filesize = file.byte_size;
|
||||
}
|
||||
@ -2019,16 +2019,16 @@ static imgtoolerr_t amiga_image_nextenum(imgtool_directory *enumeration, imgtool
|
||||
}
|
||||
|
||||
|
||||
static void amiga_image_closeenum(imgtool_directory *enumeration)
|
||||
static void amiga_image_closeenum(imgtool::directory *enumeration)
|
||||
{
|
||||
free(enumeration);
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t amiga_image_freespace(imgtool_partition *partition, UINT64 *size)
|
||||
static imgtoolerr_t amiga_image_freespace(imgtool::partition *partition, UINT64 *size)
|
||||
{
|
||||
imgtoolerr_t ret;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
const int data_size = is_ffs(image) ? BSIZE : BSIZE-24;
|
||||
root_block root;
|
||||
bitmap_block bm;
|
||||
@ -2079,9 +2079,9 @@ static imgtoolerr_t amiga_image_freespace(imgtool_partition *partition, UINT64 *
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t amiga_image_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t amiga_image_readfile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
imgtoolerr_t ret;
|
||||
file_block file;
|
||||
int filesize, block;
|
||||
@ -2116,9 +2116,9 @@ static imgtoolerr_t amiga_image_readfile(imgtool_partition *partition, const cha
|
||||
* the Directory block (or from the same-hash-value list) and the bitmap is
|
||||
* updated. File header block, Data blocks and File extension blocks are not
|
||||
* cleared, but the bitmap blocks are updated. */
|
||||
static imgtoolerr_t amiga_image_deletefile(imgtool_partition *partition, const char *fname)
|
||||
static imgtoolerr_t amiga_image_deletefile(imgtool::partition *partition, const char *fname)
|
||||
{
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
imgtoolerr_t ret;
|
||||
int parent, block;
|
||||
char filename[31];
|
||||
@ -2189,7 +2189,7 @@ static imgtoolerr_t amiga_image_deletefile(imgtool_partition *partition, const c
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t amiga_image_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
static imgtoolerr_t amiga_image_writefile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
return IMGTOOLERR_UNIMPLEMENTED;
|
||||
}
|
||||
@ -2300,9 +2300,9 @@ static imgtoolerr_t amiga_image_create(imgtool::image *img, imgtool_stream *stre
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t amiga_image_createdir(imgtool_partition *partition, const char *path)
|
||||
static imgtoolerr_t amiga_image_createdir(imgtool::partition *partition, const char *path)
|
||||
{
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
imgtoolerr_t ret;
|
||||
|
||||
/* Create directories */
|
||||
@ -2317,25 +2317,25 @@ static imgtoolerr_t amiga_image_createdir(imgtool_partition *partition, const ch
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t amiga_image_getattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values)
|
||||
static imgtoolerr_t amiga_image_getattrs(imgtool::partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values)
|
||||
{
|
||||
return IMGTOOLERR_UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t amiga_image_setattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values)
|
||||
static imgtoolerr_t amiga_image_setattrs(imgtool::partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values)
|
||||
{
|
||||
return IMGTOOLERR_UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t amiga_image_geticoninfo(imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo)
|
||||
static imgtoolerr_t amiga_image_geticoninfo(imgtool::partition *partition, const char *path, imgtool_iconinfo *iconinfo)
|
||||
{
|
||||
return IMGTOOLERR_UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t amiga_image_suggesttransfer(imgtool_partition *partition, const char *fname, imgtool_transfer_suggestion *suggestions, size_t suggestions_length)
|
||||
static imgtoolerr_t amiga_image_suggesttransfer(imgtool::partition *partition, const char *fname, imgtool_transfer_suggestion *suggestions, size_t suggestions_length)
|
||||
{
|
||||
return IMGTOOLERR_UNIMPLEMENTED;
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ struct granule_list_t {
|
||||
#define BML3_OPTIONS_FTYPE 'T'
|
||||
#define BML3_OPTIONS_ASCII 'M'
|
||||
|
||||
static imgtoolerr_t bml3_diskimage_deletefile(imgtool_partition *partition, const char *fname);
|
||||
static imgtoolerr_t bml3_diskimage_deletefile(imgtool::partition *partition, const char *fname);
|
||||
|
||||
|
||||
|
||||
@ -548,7 +548,7 @@ static imgtoolerr_t bml3_diskimage_open(imgtool::image *image, imgtool_stream *s
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t bml3_diskimage_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t bml3_diskimage_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
{
|
||||
floperr_t ferr;
|
||||
imgtoolerr_t err;
|
||||
@ -558,8 +558,8 @@ static imgtoolerr_t bml3_diskimage_nextenum(imgtool_directory *enumeration, imgt
|
||||
char fname[13];
|
||||
imgtool::image *image;
|
||||
|
||||
image = imgtool_directory_image(enumeration);
|
||||
rsenum = (struct bml3_direnum *) imgtool_directory_extrabytes(enumeration);
|
||||
image = &enumeration->image();
|
||||
rsenum = (struct bml3_direnum *) enumeration->extra_bytes();
|
||||
|
||||
/* Did we hit the end of file before? */
|
||||
if (rsenum->eof)
|
||||
@ -613,14 +613,14 @@ eof:
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t bml3_diskimage_freespace(imgtool_partition *partition, UINT64 *size)
|
||||
static imgtoolerr_t bml3_diskimage_freespace(imgtool::partition *partition, UINT64 *size)
|
||||
{
|
||||
floperr_t ferr;
|
||||
UINT8 i;
|
||||
size_t s = 0;
|
||||
UINT8 granule_count;
|
||||
UINT8 granule_map[MAX_GRANULEMAP_SIZE];
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
bml3_diskinfo *info = bml3_get_diskinfo(image);
|
||||
|
||||
ferr = get_granule_map(image, granule_map, &granule_count);
|
||||
@ -673,12 +673,12 @@ static imgtoolerr_t delete_entry(imgtool::image *img, struct bml3_dirent *ent, i
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t bml3_diskimage_readfile(imgtool_partition *partition, const char *fname, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t bml3_diskimage_readfile(imgtool::partition *partition, const char *fname, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
struct bml3_dirent ent;
|
||||
size_t size;
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
|
||||
err = lookup_bml3_file(img, fname, &ent, NULL);
|
||||
if (err)
|
||||
@ -696,11 +696,11 @@ static imgtoolerr_t bml3_diskimage_readfile(imgtool_partition *partition, const
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t bml3_diskimage_writefile(imgtool_partition *partition, const char *fname, const char *fork, imgtool_stream *sourcef, util::option_resolution *writeoptions)
|
||||
static imgtoolerr_t bml3_diskimage_writefile(imgtool::partition *partition, const char *fname, const char *fork, imgtool_stream *sourcef, util::option_resolution *writeoptions)
|
||||
{
|
||||
floperr_t ferr;
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
bml3_diskinfo *info = bml3_get_diskinfo(img);
|
||||
struct bml3_dirent ent, ent2;
|
||||
size_t i;
|
||||
@ -817,10 +817,10 @@ static imgtoolerr_t bml3_diskimage_writefile(imgtool_partition *partition, const
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t bml3_diskimage_deletefile(imgtool_partition *partition, const char *fname)
|
||||
static imgtoolerr_t bml3_diskimage_deletefile(imgtool::partition *partition, const char *fname)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
int pos = 0;
|
||||
struct bml3_dirent ent;
|
||||
|
||||
@ -833,10 +833,10 @@ static imgtoolerr_t bml3_diskimage_deletefile(imgtool_partition *partition, cons
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t bml3_diskimage_suggesttransfer(imgtool_partition *partition, const char *fname, imgtool_transfer_suggestion *suggestions, size_t suggestions_length)
|
||||
static imgtoolerr_t bml3_diskimage_suggesttransfer(imgtool::partition *partition, const char *fname, imgtool_transfer_suggestion *suggestions, size_t suggestions_length)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
struct bml3_dirent ent;
|
||||
int pos;
|
||||
|
||||
|
@ -129,14 +129,14 @@ struct concept_iterator
|
||||
static imgtoolerr_t concept_image_init(imgtool::image *img, imgtool_stream *f);
|
||||
static void concept_image_exit(imgtool::image *img);
|
||||
static void concept_image_info(imgtool::image *img, char *string, size_t len);
|
||||
static imgtoolerr_t concept_image_beginenum(imgtool_directory *enumeration, const char *path);
|
||||
static imgtoolerr_t concept_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent);
|
||||
static void concept_image_closeenum(imgtool_directory *enumeration);
|
||||
static imgtoolerr_t concept_image_freespace(imgtool_partition *partition, UINT64 *size);
|
||||
static imgtoolerr_t concept_image_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf);
|
||||
static imgtoolerr_t concept_image_beginenum(imgtool::directory *enumeration, const char *path);
|
||||
static imgtoolerr_t concept_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent);
|
||||
static void concept_image_closeenum(imgtool::directory *enumeration);
|
||||
static imgtoolerr_t concept_image_freespace(imgtool::partition *partition, UINT64 *size);
|
||||
static imgtoolerr_t concept_image_readfile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf);
|
||||
#if 0
|
||||
static imgtoolerr_t concept_image_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *writeoptions);
|
||||
static imgtoolerr_t concept_image_deletefile(imgtool_partition *partition, const char *filename);
|
||||
static imgtoolerr_t concept_image_writefile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *writeoptions);
|
||||
static imgtoolerr_t concept_image_deletefile(imgtool::partition *partition, const char *filename);
|
||||
static imgtoolerr_t concept_image_create(const imgtool_module *mod, imgtool_stream *f, util::option_resolution *createoptions);
|
||||
#endif
|
||||
|
||||
@ -319,12 +319,12 @@ static void concept_image_info(imgtool::image *img, char *string, size_t len)
|
||||
/*
|
||||
Open the disk catalog for enumeration
|
||||
*/
|
||||
static imgtoolerr_t concept_image_beginenum(imgtool_directory *enumeration, const char *path)
|
||||
static imgtoolerr_t concept_image_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
{
|
||||
concept_iterator *iter;
|
||||
|
||||
iter = (concept_iterator *) imgtool_directory_extrabytes(enumeration);
|
||||
iter->image = (concept_image *) imgtool_directory_image(enumeration)->extra_bytes();
|
||||
iter = (concept_iterator *) enumeration->extra_bytes();
|
||||
iter->image = (concept_image *) enumeration->image().extra_bytes();
|
||||
iter->index = 0;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
@ -332,9 +332,9 @@ static imgtoolerr_t concept_image_beginenum(imgtool_directory *enumeration, cons
|
||||
/*
|
||||
Enumerate disk catalog next entry
|
||||
*/
|
||||
static imgtoolerr_t concept_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t concept_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
{
|
||||
concept_iterator *iter = (concept_iterator *) imgtool_directory_extrabytes(enumeration);
|
||||
concept_iterator *iter = (concept_iterator *) enumeration->extra_bytes();
|
||||
|
||||
|
||||
ent->corrupt = 0;
|
||||
@ -393,16 +393,16 @@ static imgtoolerr_t concept_image_nextenum(imgtool_directory *enumeration, imgto
|
||||
/*
|
||||
Free enumerator
|
||||
*/
|
||||
static void concept_image_closeenum(imgtool_directory *enumeration)
|
||||
static void concept_image_closeenum(imgtool::directory *enumeration)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
Compute free space on disk image
|
||||
*/
|
||||
static imgtoolerr_t concept_image_freespace(imgtool_partition *partition, UINT64 *size)
|
||||
static imgtoolerr_t concept_image_freespace(imgtool::partition *partition, UINT64 *size)
|
||||
{
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
concept_image *image = (concept_image*) img;
|
||||
int free_blocks;
|
||||
int i;
|
||||
@ -426,9 +426,9 @@ static imgtoolerr_t concept_image_freespace(imgtool_partition *partition, UINT64
|
||||
/*
|
||||
Extract a file from a concept_image.
|
||||
*/
|
||||
static imgtoolerr_t concept_image_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t concept_image_readfile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
concept_image *image = (concept_image *) img->extra_bytes();
|
||||
size_t filename_len = strlen(filename);
|
||||
unsigned char concept_fname[16];
|
||||
@ -463,7 +463,7 @@ static imgtoolerr_t concept_image_readfile(imgtool_partition *partition, const c
|
||||
/*
|
||||
Add a file to a concept_image.
|
||||
*/
|
||||
static imgtoolerr_t concept_image_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *writeoptions)
|
||||
static imgtoolerr_t concept_image_writefile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *writeoptions)
|
||||
{
|
||||
/* ... */
|
||||
|
||||
@ -473,7 +473,7 @@ static imgtoolerr_t concept_image_writefile(imgtool_partition *partition, const
|
||||
/*
|
||||
Delete a file from a concept_image.
|
||||
*/
|
||||
static imgtoolerr_t concept_image_deletefile(imgtool_partition *partition, const char *filename)
|
||||
static imgtoolerr_t concept_image_deletefile(imgtool::partition *partition, const char *filename)
|
||||
{
|
||||
/* ... */
|
||||
|
||||
|
@ -377,18 +377,18 @@ static imgtoolerr_t cybiko_image_create( imgtool::image *image, imgtool_stream *
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_begin_enum( imgtool_directory *enumeration, const char *path)
|
||||
static imgtoolerr_t cybiko_image_begin_enum( imgtool::directory *enumeration, const char *path)
|
||||
{
|
||||
cybiko_iter *iter = (cybiko_iter*)imgtool_directory_extrabytes( enumeration);
|
||||
cybiko_iter *iter = (cybiko_iter*)enumeration->extra_bytes();
|
||||
iter->block = 0;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_next_enum( imgtool_directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t cybiko_image_next_enum( imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
{
|
||||
imgtool::image *image = imgtool_directory_image( enumeration);
|
||||
imgtool::image *image = &enumeration->image();
|
||||
cybiko_file_system *cfs = (cybiko_file_system*)image->extra_bytes();
|
||||
cybiko_iter *iter = (cybiko_iter*)imgtool_directory_extrabytes( enumeration);
|
||||
cybiko_iter *iter = (cybiko_iter*)enumeration->extra_bytes();
|
||||
UINT8 buffer[MAX_PAGE_SIZE];
|
||||
UINT16 file_id = INVALID_FILE_ID;
|
||||
cfs_file file;
|
||||
@ -418,22 +418,22 @@ static imgtoolerr_t cybiko_image_next_enum( imgtool_directory *enumeration, imgt
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static void cybiko_image_close_enum( imgtool_directory *enumeration)
|
||||
static void cybiko_image_close_enum( imgtool::directory *enumeration)
|
||||
{
|
||||
// nothing
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_free_space( imgtool_partition *partition, UINT64 *size)
|
||||
static imgtoolerr_t cybiko_image_free_space( imgtool::partition *partition, UINT64 *size)
|
||||
{
|
||||
imgtool::image *image = imgtool_partition_image( partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
cybiko_file_system *cfs = (cybiko_file_system*)image->extra_bytes();
|
||||
if (size) *size = cfs_calc_free_space( cfs, cfs_calc_free_blocks( cfs));
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_read_file( imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t cybiko_image_read_file( imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
imgtool::image *image = imgtool_partition_image( partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
cybiko_file_system *cfs = (cybiko_file_system*)image->extra_bytes();
|
||||
UINT8 buffer[MAX_PAGE_SIZE];
|
||||
UINT16 file_id, part_id = 0, old_part_id;
|
||||
@ -458,9 +458,9 @@ static imgtoolerr_t cybiko_image_read_file( imgtool_partition *partition, const
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_write_file( imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
static imgtoolerr_t cybiko_image_write_file( imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
imgtool::image *image = imgtool_partition_image( partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
cybiko_file_system *cfs = (cybiko_file_system*)image->extra_bytes();
|
||||
UINT8 buffer[MAX_PAGE_SIZE];
|
||||
UINT16 file_id, part_id = 0, free_blocks;
|
||||
@ -518,9 +518,9 @@ static imgtoolerr_t cybiko_image_write_file( imgtool_partition *partition, const
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_delete_file( imgtool_partition *partition, const char *filename)
|
||||
static imgtoolerr_t cybiko_image_delete_file( imgtool::partition *partition, const char *filename)
|
||||
{
|
||||
imgtool::image *image = imgtool_partition_image( partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
cybiko_file_system *cfs = (cybiko_file_system*)image->extra_bytes();
|
||||
UINT16 file_id;
|
||||
// find file
|
||||
|
@ -347,18 +347,18 @@ static imgtoolerr_t cybiko_image_create( imgtool::image *image, imgtool_stream *
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_begin_enum( imgtool_directory *enumeration, const char *path)
|
||||
static imgtoolerr_t cybiko_image_begin_enum( imgtool::directory *enumeration, const char *path)
|
||||
{
|
||||
cybiko_iter *iter = (cybiko_iter*)imgtool_directory_extrabytes( enumeration);
|
||||
cybiko_iter *iter = (cybiko_iter*)enumeration->extra_bytes();
|
||||
iter->block = 0;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_next_enum( imgtool_directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t cybiko_image_next_enum( imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
{
|
||||
imgtool::image *image = imgtool_directory_image( enumeration);
|
||||
imgtool::image *image = &enumeration->image();
|
||||
cybiko_file_system *cfs = (cybiko_file_system*)image->extra_bytes();
|
||||
cybiko_iter *iter = (cybiko_iter*)imgtool_directory_extrabytes( enumeration);
|
||||
cybiko_iter *iter = (cybiko_iter*)enumeration->extra_bytes();
|
||||
UINT8 buffer[MAX_PAGE_SIZE];
|
||||
UINT16 file_id = INVALID_FILE_ID;
|
||||
cfs_file file;
|
||||
@ -388,22 +388,22 @@ static imgtoolerr_t cybiko_image_next_enum( imgtool_directory *enumeration, imgt
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static void cybiko_image_close_enum( imgtool_directory *enumeration)
|
||||
static void cybiko_image_close_enum( imgtool::directory *enumeration)
|
||||
{
|
||||
// nothing
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_free_space( imgtool_partition *partition, UINT64 *size)
|
||||
static imgtoolerr_t cybiko_image_free_space( imgtool::partition *partition, UINT64 *size)
|
||||
{
|
||||
imgtool::image *image = imgtool_partition_image( partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
cybiko_file_system *cfs = (cybiko_file_system*)image->extra_bytes();
|
||||
if (size) *size = cfs_calc_free_space( cfs, cfs_calc_free_blocks( cfs));
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_read_file( imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t cybiko_image_read_file( imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
imgtool::image *image = imgtool_partition_image( partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
cybiko_file_system *cfs = (cybiko_file_system*)image->extra_bytes();
|
||||
UINT8 buffer[MAX_PAGE_SIZE];
|
||||
UINT16 file_id, part_id = 0, old_part_id;
|
||||
@ -430,9 +430,9 @@ static imgtoolerr_t cybiko_image_read_file( imgtool_partition *partition, const
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_write_file( imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
static imgtoolerr_t cybiko_image_write_file( imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
imgtool::image *image = imgtool_partition_image( partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
cybiko_file_system *cfs = (cybiko_file_system*)image->extra_bytes();
|
||||
UINT8 buffer[MAX_PAGE_SIZE];
|
||||
UINT16 file_id, part_id = 0, free_blocks;
|
||||
@ -493,9 +493,9 @@ static imgtoolerr_t cybiko_image_write_file( imgtool_partition *partition, const
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t cybiko_image_delete_file( imgtool_partition *partition, const char *filename)
|
||||
static imgtoolerr_t cybiko_image_delete_file( imgtool::partition *partition, const char *filename)
|
||||
{
|
||||
imgtool::image *image = imgtool_partition_image( partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
cybiko_file_system *cfs = (cybiko_file_system*)image->extra_bytes();
|
||||
UINT16 file_id;
|
||||
// check filename
|
||||
|
@ -275,14 +275,14 @@ static const char fat32_string[8] = { 'F', 'A', 'T', '3', '2', ' ', ' ', ' ' };
|
||||
|
||||
|
||||
|
||||
static fat_partition_info *fat_get_partition_info(imgtool_partition *partition)
|
||||
static fat_partition_info *fat_get_partition_info(imgtool::partition *partition)
|
||||
{
|
||||
return (fat_partition_info *) imgtool_partition_extra_bytes(partition);
|
||||
return (fat_partition_info *)partition->extra_bytes();
|
||||
}
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_read_sector(imgtool_partition *partition, UINT32 sector_index,
|
||||
static imgtoolerr_t fat_read_sector(imgtool::partition *partition, UINT32 sector_index,
|
||||
int offset, void *buffer, size_t buffer_len)
|
||||
{
|
||||
//const fat_partition_info *disk_info;
|
||||
@ -294,14 +294,14 @@ static imgtoolerr_t fat_read_sector(imgtool_partition *partition, UINT32 sector_
|
||||
//disk_info = fat_get_partition_info(partition);
|
||||
|
||||
/* sanity check */
|
||||
err = imgtool_partition_get_block_size(partition, block_size);
|
||||
err = partition->get_block_size(block_size);
|
||||
if (err)
|
||||
return err;
|
||||
assert(block_size == sizeof(data));
|
||||
|
||||
while(buffer_len > 0)
|
||||
{
|
||||
err = imgtool_partition_read_block(partition, sector_index++, data);
|
||||
err = partition->read_block(sector_index++, data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@ -317,7 +317,7 @@ static imgtoolerr_t fat_read_sector(imgtool_partition *partition, UINT32 sector_
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_write_sector(imgtool_partition *partition, UINT32 sector_index,
|
||||
static imgtoolerr_t fat_write_sector(imgtool::partition *partition, UINT32 sector_index,
|
||||
int offset, const void *buffer, size_t buffer_len)
|
||||
{
|
||||
//const fat_partition_info *disk_info;
|
||||
@ -330,7 +330,7 @@ static imgtoolerr_t fat_write_sector(imgtool_partition *partition, UINT32 sector
|
||||
//disk_info = fat_get_partition_info(partition);
|
||||
|
||||
/* sanity check */
|
||||
err = imgtool_partition_get_block_size(partition, block_size);
|
||||
err = partition->get_block_size(block_size);
|
||||
if (err)
|
||||
return err;
|
||||
assert(block_size == sizeof(data));
|
||||
@ -341,7 +341,7 @@ static imgtoolerr_t fat_write_sector(imgtool_partition *partition, UINT32 sector
|
||||
|
||||
if ((offset != 0) || (buffer_len < sizeof(data)))
|
||||
{
|
||||
err = imgtool_partition_read_block(partition, sector_index, data);
|
||||
err = partition->read_block(sector_index, data);
|
||||
if (err)
|
||||
return err;
|
||||
memcpy(data + offset, buffer, len);
|
||||
@ -352,7 +352,7 @@ static imgtoolerr_t fat_write_sector(imgtool_partition *partition, UINT32 sector
|
||||
write_data = buffer;
|
||||
}
|
||||
|
||||
err = imgtool_partition_write_block(partition, sector_index++, write_data);
|
||||
err = partition->write_block(sector_index++, write_data);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@ -365,7 +365,7 @@ static imgtoolerr_t fat_write_sector(imgtool_partition *partition, UINT32 sector
|
||||
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
static imgtoolerr_t fat_clear_sector(imgtool_partition *partition, UINT32 sector_index, UINT8 data)
|
||||
static imgtoolerr_t fat_clear_sector(imgtool::partition *partition, UINT32 sector_index, UINT8 data)
|
||||
{
|
||||
char buf[FAT_SECLEN];
|
||||
memset(buf, data, sizeof(buf));
|
||||
@ -374,7 +374,7 @@ static imgtoolerr_t fat_clear_sector(imgtool_partition *partition, UINT32 sector
|
||||
#endif
|
||||
|
||||
|
||||
static imgtoolerr_t fat_partition_open(imgtool_partition *partition, UINT64 first_block, UINT64 block_count)
|
||||
static imgtoolerr_t fat_partition_open(imgtool::partition *partition, UINT64 first_block, UINT64 block_count)
|
||||
{
|
||||
UINT8 header[FAT_SECLEN];
|
||||
imgtoolerr_t err;
|
||||
@ -593,7 +593,7 @@ static imgtoolerr_t fat_partition_create(imgtool::image *image, UINT64 first_blo
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_load_fat(imgtool_partition *partition, UINT8 **fat_table)
|
||||
static imgtoolerr_t fat_load_fat(imgtool::partition *partition, UINT8 **fat_table)
|
||||
{
|
||||
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
|
||||
const fat_partition_info *disk_info;
|
||||
@ -641,7 +641,7 @@ done:
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_save_fat(imgtool_partition *partition, const UINT8 *fat_table)
|
||||
static imgtoolerr_t fat_save_fat(imgtool::partition *partition, const UINT8 *fat_table)
|
||||
{
|
||||
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
|
||||
const fat_partition_info *disk_info;
|
||||
@ -673,7 +673,7 @@ done:
|
||||
|
||||
|
||||
|
||||
static UINT32 fat_get_fat_entry(imgtool_partition *partition, const UINT8 *fat_table, UINT32 fat_entry)
|
||||
static UINT32 fat_get_fat_entry(imgtool::partition *partition, const UINT8 *fat_table, UINT32 fat_entry)
|
||||
{
|
||||
const fat_partition_info *disk_info;
|
||||
UINT64 entry;
|
||||
@ -720,7 +720,7 @@ static UINT32 fat_get_fat_entry(imgtool_partition *partition, const UINT8 *fat_t
|
||||
|
||||
|
||||
|
||||
static void fat_set_fat_entry(imgtool_partition *partition, UINT8 *fat_table, UINT32 fat_entry, UINT32 value)
|
||||
static void fat_set_fat_entry(imgtool::partition *partition, UINT8 *fat_table, UINT32 fat_entry, UINT32 value)
|
||||
{
|
||||
const fat_partition_info *disk_info;
|
||||
UINT64 entry;
|
||||
@ -747,7 +747,7 @@ static void fat_set_fat_entry(imgtool_partition *partition, UINT8 *fat_table, UI
|
||||
|
||||
|
||||
|
||||
static void fat_debug_integrity_check(imgtool_partition *partition, const UINT8 *fat_table, const fat_file *file)
|
||||
static void fat_debug_integrity_check(imgtool::partition *partition, const UINT8 *fat_table, const fat_file *file)
|
||||
{
|
||||
#ifdef MAME_DEBUG
|
||||
/* debug function to test the integrity of a file */
|
||||
@ -770,7 +770,7 @@ static void fat_debug_integrity_check(imgtool_partition *partition, const UINT8
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_seek_file(imgtool_partition *partition, fat_file *file, UINT32 pos)
|
||||
static imgtoolerr_t fat_seek_file(imgtool::partition *partition, fat_file *file, UINT32 pos)
|
||||
{
|
||||
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
|
||||
const fat_partition_info *disk_info;
|
||||
@ -831,7 +831,7 @@ done:
|
||||
|
||||
|
||||
|
||||
static UINT32 fat_get_filepos_sector_index(imgtool_partition *partition, fat_file *file)
|
||||
static UINT32 fat_get_filepos_sector_index(imgtool::partition *partition, fat_file *file)
|
||||
{
|
||||
UINT32 sector_index;
|
||||
const fat_partition_info *disk_info;
|
||||
@ -873,7 +873,7 @@ static imgtoolerr_t fat_corrupt_file_error(const fat_file *file)
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_readwrite_file(imgtool_partition *partition, fat_file *file,
|
||||
static imgtoolerr_t fat_readwrite_file(imgtool::partition *partition, fat_file *file,
|
||||
void *buffer, size_t buffer_len, size_t *bytes_read, int read_or_write)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
@ -921,7 +921,7 @@ static imgtoolerr_t fat_readwrite_file(imgtool_partition *partition, fat_file *f
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_read_file(imgtool_partition *partition, fat_file *file,
|
||||
static imgtoolerr_t fat_read_file(imgtool::partition *partition, fat_file *file,
|
||||
void *buffer, size_t buffer_len, size_t *bytes_read)
|
||||
{
|
||||
return fat_readwrite_file(partition, file, buffer, buffer_len, bytes_read, 0);
|
||||
@ -929,7 +929,7 @@ static imgtoolerr_t fat_read_file(imgtool_partition *partition, fat_file *file,
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_write_file(imgtool_partition *partition, fat_file *file,
|
||||
static imgtoolerr_t fat_write_file(imgtool::partition *partition, fat_file *file,
|
||||
const void *buffer, size_t buffer_len, size_t *bytes_read)
|
||||
{
|
||||
return fat_readwrite_file(partition, file, (void *) buffer, buffer_len, bytes_read, 1);
|
||||
@ -937,7 +937,7 @@ static imgtoolerr_t fat_write_file(imgtool_partition *partition, fat_file *file,
|
||||
|
||||
|
||||
|
||||
static UINT32 fat_allocate_cluster(imgtool_partition *partition, UINT8 *fat_table)
|
||||
static UINT32 fat_allocate_cluster(imgtool::partition *partition, UINT8 *fat_table)
|
||||
{
|
||||
const fat_partition_info *disk_info;
|
||||
UINT32 i, val;
|
||||
@ -959,7 +959,7 @@ static UINT32 fat_allocate_cluster(imgtool_partition *partition, UINT8 *fat_tabl
|
||||
|
||||
|
||||
/* sets the size of a file; ~0 means 'delete' */
|
||||
static imgtoolerr_t fat_set_file_size(imgtool_partition *partition, fat_file *file,
|
||||
static imgtoolerr_t fat_set_file_size(imgtool::partition *partition, fat_file *file,
|
||||
UINT32 new_size)
|
||||
{
|
||||
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
|
||||
@ -1277,7 +1277,7 @@ static UINT32 fat_setup_time(time_t ansi_time)
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_read_dirent(imgtool_partition *partition, fat_file *file,
|
||||
static imgtoolerr_t fat_read_dirent(imgtool::partition *partition, fat_file *file,
|
||||
fat_dirent *ent, fat_freeentry_info *freeent)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
@ -1600,7 +1600,7 @@ done:
|
||||
|
||||
|
||||
|
||||
static void fat_bump_dirent(imgtool_partition *partition, UINT8 *entry, size_t entry_len)
|
||||
static void fat_bump_dirent(imgtool::partition *partition, UINT8 *entry, size_t entry_len)
|
||||
{
|
||||
UINT8 *sfn_entry;
|
||||
int pos, digit_count, i;
|
||||
@ -1635,7 +1635,7 @@ static void fat_bump_dirent(imgtool_partition *partition, UINT8 *entry, size_t e
|
||||
{
|
||||
/* extreme degenerate case; simply randomize the filename */
|
||||
for (i = 0; i < 6; i++)
|
||||
sfn_entry[i] = 'A' + (imgtool_partition_rand(partition) % 26);
|
||||
sfn_entry[i] = 'A' + (imgtool::image::rand() % 26);
|
||||
sfn_entry[6] = '~';
|
||||
sfn_entry[7] = '0';
|
||||
}
|
||||
@ -1661,7 +1661,7 @@ static void fat_bump_dirent(imgtool_partition *partition, UINT8 *entry, size_t e
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_lookup_path(imgtool_partition *partition, const char *path,
|
||||
static imgtoolerr_t fat_lookup_path(imgtool::partition *partition, const char *path,
|
||||
creation_policy_t create, fat_file *file)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
@ -1809,14 +1809,14 @@ done:
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_partition_beginenum(imgtool_directory *enumeration, const char *path)
|
||||
static imgtoolerr_t fat_partition_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
fat_file *file;
|
||||
|
||||
file = (fat_file *) imgtool_directory_extrabytes(enumeration);
|
||||
file = (fat_file *) enumeration->extra_bytes();
|
||||
|
||||
err = fat_lookup_path(imgtool_directory_partition(enumeration), path, CREATE_NONE, file);
|
||||
err = fat_lookup_path(&enumeration->partition(), path, CREATE_NONE, file);
|
||||
if (err)
|
||||
return err;
|
||||
if (!file->directory)
|
||||
@ -1826,14 +1826,14 @@ static imgtoolerr_t fat_partition_beginenum(imgtool_directory *enumeration, cons
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_partition_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t fat_partition_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
fat_file *file;
|
||||
fat_dirent fatent;
|
||||
|
||||
file = (fat_file *) imgtool_directory_extrabytes(enumeration);
|
||||
err = fat_read_dirent(imgtool_directory_partition(enumeration), file, &fatent, NULL);
|
||||
file = (fat_file *) enumeration->extra_bytes();
|
||||
err = fat_read_dirent(&enumeration->partition(), file, &fatent, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@ -1850,7 +1850,7 @@ static imgtoolerr_t fat_partition_nextenum(imgtool_directory *enumeration, imgto
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_read_bootblock(imgtool_partition *partition, imgtool_stream *stream)
|
||||
static imgtoolerr_t fat_read_bootblock(imgtool::partition *partition, imgtool_stream *stream)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
UINT8 block[FAT_SECLEN];
|
||||
@ -1865,7 +1865,7 @@ static imgtoolerr_t fat_read_bootblock(imgtool_partition *partition, imgtool_str
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_write_bootblock(imgtool_partition *partition, imgtool_stream *stream)
|
||||
static imgtoolerr_t fat_write_bootblock(imgtool::partition *partition, imgtool_stream *stream)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
UINT8 block[FAT_SECLEN];
|
||||
@ -1899,7 +1899,7 @@ static imgtoolerr_t fat_write_bootblock(imgtool_partition *partition, imgtool_st
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_partition_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t fat_partition_readfile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
fat_file file;
|
||||
@ -1931,7 +1931,7 @@ static imgtoolerr_t fat_partition_readfile(imgtool_partition *partition, const c
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_partition_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
static imgtoolerr_t fat_partition_writefile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
fat_file file;
|
||||
@ -1971,7 +1971,7 @@ static imgtoolerr_t fat_partition_writefile(imgtool_partition *partition, const
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_partition_delete(imgtool_partition *partition, const char *filename, unsigned int dir)
|
||||
static imgtoolerr_t fat_partition_delete(imgtool::partition *partition, const char *filename, unsigned int dir)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
fat_file file;
|
||||
@ -2001,14 +2001,14 @@ static imgtoolerr_t fat_partition_delete(imgtool_partition *partition, const cha
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_partition_deletefile(imgtool_partition *partition, const char *filename)
|
||||
static imgtoolerr_t fat_partition_deletefile(imgtool::partition *partition, const char *filename)
|
||||
{
|
||||
return fat_partition_delete(partition, filename, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_partition_freespace(imgtool_partition *partition, UINT64 *size)
|
||||
static imgtoolerr_t fat_partition_freespace(imgtool::partition *partition, UINT64 *size)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
const fat_partition_info *disk_info;
|
||||
@ -2036,7 +2036,7 @@ done:
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_partition_createdir(imgtool_partition *partition, const char *path)
|
||||
static imgtoolerr_t fat_partition_createdir(imgtool::partition *partition, const char *path)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
fat_file file;
|
||||
@ -2070,7 +2070,7 @@ static imgtoolerr_t fat_partition_createdir(imgtool_partition *partition, const
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t fat_partition_deletedir(imgtool_partition *partition, const char *path)
|
||||
static imgtoolerr_t fat_partition_deletedir(imgtool::partition *partition, const char *path)
|
||||
{
|
||||
return fat_partition_delete(partition, path, 1);
|
||||
}
|
||||
|
@ -436,12 +436,12 @@ static imgtoolerr_t hp48_list_partitions(imgtool::image *img,
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t hp48_open_partition(imgtool_partition *part,
|
||||
static imgtoolerr_t hp48_open_partition(imgtool::partition *part,
|
||||
UINT64 first_block, UINT64 block_count)
|
||||
{
|
||||
imgtool::image* img = imgtool_partition_image( part );
|
||||
imgtool::image* img = &part->image();
|
||||
hp48_card* c = (hp48_card*) img->extra_bytes();
|
||||
hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part );
|
||||
hp48_partition* p = (hp48_partition*) part->extra_bytes();
|
||||
|
||||
if ( first_block + block_count > c->size )
|
||||
return IMGTOOLERR_INVALIDPARTITION;
|
||||
@ -455,10 +455,10 @@ static imgtoolerr_t hp48_open_partition(imgtool_partition *part,
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t hp48_beginenum(imgtool_directory *enumeration,
|
||||
static imgtoolerr_t hp48_beginenum(imgtool::directory *enumeration,
|
||||
const char *path)
|
||||
{
|
||||
hp48_directory* d = (hp48_directory*) imgtool_directory_extrabytes( enumeration );
|
||||
hp48_directory* d = (hp48_directory*) enumeration->extra_bytes();
|
||||
|
||||
d->pos = 0;
|
||||
|
||||
@ -467,14 +467,14 @@ static imgtoolerr_t hp48_beginenum(imgtool_directory *enumeration,
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t hp48_nextenum(imgtool_directory *enumeration,
|
||||
static imgtoolerr_t hp48_nextenum(imgtool::directory *enumeration,
|
||||
imgtool_dirent *ent)
|
||||
{
|
||||
imgtool_partition *part = imgtool_directory_partition( enumeration );
|
||||
//imgtool::image* img = imgtool_partition_image( part );
|
||||
imgtool::partition *part = &enumeration->partition();
|
||||
//imgtool::image* img = &part->image();
|
||||
//hp48_card* c = (hp48_card*) img->extra_bytes();
|
||||
hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part );
|
||||
hp48_directory* d = (hp48_directory*) imgtool_directory_extrabytes( enumeration );
|
||||
hp48_partition* p = (hp48_partition*) part->extra_bytes();
|
||||
hp48_directory* d = (hp48_directory*) enumeration->extra_bytes();
|
||||
|
||||
UINT8* data = p->data;
|
||||
int pos = d->pos;
|
||||
@ -526,11 +526,11 @@ static imgtoolerr_t hp48_nextenum(imgtool_directory *enumeration,
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t hp48_freespace(imgtool_partition *part, UINT64 *size)
|
||||
static imgtoolerr_t hp48_freespace(imgtool::partition *part, UINT64 *size)
|
||||
{
|
||||
//imgtool::image* img = imgtool_partition_image( part );
|
||||
//imgtool::image* img = &part->image();
|
||||
//hp48_card* c = (hp48_card*) img->extra_bytes();
|
||||
hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part );
|
||||
hp48_partition* p = (hp48_partition*) part->extra_bytes();
|
||||
|
||||
*size = p->size - (find_end(p)+1)/2;
|
||||
|
||||
@ -539,14 +539,14 @@ static imgtoolerr_t hp48_freespace(imgtool_partition *part, UINT64 *size)
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t hp48_readfile(imgtool_partition *part,
|
||||
static imgtoolerr_t hp48_readfile(imgtool::partition *part,
|
||||
const char *filename,
|
||||
const char *fork,
|
||||
imgtool_stream *destf)
|
||||
{
|
||||
//imgtool::image* img = imgtool_partition_image( part );
|
||||
//imgtool::image* img = &part->image();
|
||||
//hp48_card* c = (hp48_card*) img->extra_bytes();
|
||||
hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part );
|
||||
hp48_partition* p = (hp48_partition*) part->extra_bytes();
|
||||
|
||||
/* find entry */
|
||||
int totalsize, start, size;
|
||||
@ -584,12 +584,12 @@ static imgtoolerr_t hp48_readfile(imgtool_partition *part,
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t hp48_deletefile(imgtool_partition *part,
|
||||
static imgtoolerr_t hp48_deletefile(imgtool::partition *part,
|
||||
const char *filename)
|
||||
{
|
||||
imgtool::image* img = imgtool_partition_image( part );
|
||||
imgtool::image* img = &part->image();
|
||||
hp48_card* c = (hp48_card*) img->extra_bytes();
|
||||
hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part );
|
||||
hp48_partition* p = (hp48_partition*) part->extra_bytes();
|
||||
|
||||
/* find entry */
|
||||
int totalsize;
|
||||
@ -610,15 +610,15 @@ static imgtoolerr_t hp48_deletefile(imgtool_partition *part,
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t hp48_writefile(imgtool_partition *part,
|
||||
static imgtoolerr_t hp48_writefile(imgtool::partition *part,
|
||||
const char *filename,
|
||||
const char *fork,
|
||||
imgtool_stream *sourcef,
|
||||
util::option_resolution *opts)
|
||||
{
|
||||
imgtool::image* img = imgtool_partition_image( part );
|
||||
imgtool::image* img = &part->image();
|
||||
hp48_card* c = (hp48_card*) img->extra_bytes();
|
||||
hp48_partition* p = (hp48_partition*) imgtool_partition_extra_bytes( part );
|
||||
hp48_partition* p = (hp48_partition*) part->extra_bytes();
|
||||
|
||||
/* check header */
|
||||
char head[8];
|
||||
|
@ -1081,20 +1081,20 @@ static void hp9845_tape_close(imgtool::image *image)
|
||||
global_free(&tape_image);
|
||||
}
|
||||
|
||||
static imgtoolerr_t hp9845_tape_begin_enum (imgtool_directory *enumeration, const char *path)
|
||||
static imgtoolerr_t hp9845_tape_begin_enum (imgtool::directory *enumeration, const char *path)
|
||||
{
|
||||
dir_state_t *ds = (dir_state_t*)imgtool_directory_extrabytes(enumeration);
|
||||
dir_state_t *ds = (dir_state_t*)enumeration->extra_bytes();
|
||||
|
||||
ds->dir_idx = 0;
|
||||
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t hp9845_tape_next_enum (imgtool_directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t hp9845_tape_next_enum (imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
{
|
||||
tape_state_t& state = get_tape_state(imgtool_directory_image(enumeration));
|
||||
tape_state_t& state = get_tape_state(&enumeration->image());
|
||||
tape_image_t& tape_image = get_tape_image(state);
|
||||
dir_state_t *ds = (dir_state_t*)imgtool_directory_extrabytes(enumeration);
|
||||
dir_state_t *ds = (dir_state_t*)enumeration->extra_bytes();
|
||||
|
||||
const dir_entry_t *entry = nullptr;
|
||||
|
||||
@ -1115,9 +1115,9 @@ static imgtoolerr_t hp9845_tape_next_enum (imgtool_directory *enumeration, imgto
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t hp9845_tape_free_space(imgtool_partition *partition, UINT64 *size)
|
||||
static imgtoolerr_t hp9845_tape_free_space(imgtool::partition *partition, UINT64 *size)
|
||||
{
|
||||
tape_state_t& state = get_tape_state(imgtool_partition_image(partition));
|
||||
tape_state_t& state = get_tape_state(&partition->image());
|
||||
tape_image_t& tape_image = get_tape_image(state);
|
||||
|
||||
*size = tape_image.free_sectors() * SECTOR_LEN;
|
||||
@ -1125,9 +1125,9 @@ static imgtoolerr_t hp9845_tape_free_space(imgtool_partition *partition, UINT64
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t hp9845_tape_read_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t hp9845_tape_read_file(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
tape_state_t& state = get_tape_state(imgtool_partition_image(partition));
|
||||
tape_state_t& state = get_tape_state(&partition->image());
|
||||
tape_image_t& tape_image = get_tape_image(state);
|
||||
|
||||
unsigned idx;
|
||||
@ -1159,9 +1159,9 @@ static imgtoolerr_t hp9845_tape_read_file(imgtool_partition *partition, const ch
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t hp9845_tape_write_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
static imgtoolerr_t hp9845_tape_write_file(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
tape_state_t& state = get_tape_state(imgtool_partition_image(partition));
|
||||
tape_state_t& state = get_tape_state(&partition->image());
|
||||
tape_image_t& tape_image = get_tape_image(state);
|
||||
|
||||
unsigned idx;
|
||||
@ -1245,9 +1245,9 @@ static imgtoolerr_t hp9845_tape_write_file(imgtool_partition *partition, const c
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t hp9845_tape_delete_file(imgtool_partition *partition, const char *filename)
|
||||
static imgtoolerr_t hp9845_tape_delete_file(imgtool::partition *partition, const char *filename)
|
||||
{
|
||||
tape_state_t& state = get_tape_state(imgtool_partition_image(partition));
|
||||
tape_state_t& state = get_tape_state(&partition->image());
|
||||
tape_image_t& tape_image = get_tape_image(state);
|
||||
|
||||
unsigned idx;
|
||||
@ -1392,7 +1392,7 @@ static bool dump_string(imgtool_stream *inp, imgtool_stream *out , unsigned len
|
||||
return true;
|
||||
}
|
||||
|
||||
static imgtoolerr_t hp9845data_read_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t hp9845data_read_file(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
imgtool_stream *inp_data;
|
||||
imgtoolerr_t res;
|
||||
@ -1533,7 +1533,7 @@ static bool split_string_n_dump(const char *s , imgtool_stream *dest)
|
||||
return true;
|
||||
}
|
||||
|
||||
static imgtoolerr_t hp9845data_write_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
static imgtoolerr_t hp9845data_write_file(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
imgtool_stream *out_data;
|
||||
|
||||
|
@ -5274,11 +5274,11 @@ static imgtoolerr_t get_comment(struct mac_l2_imgref *l2_img, UINT16 id, mac_str
|
||||
static void mac_image_exit(imgtool::image *img);
|
||||
#endif
|
||||
static void mac_image_info(imgtool::image *img, char *string, size_t len);
|
||||
static imgtoolerr_t mac_image_beginenum(imgtool_directory *enumeration, const char *path);
|
||||
static imgtoolerr_t mac_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent);
|
||||
static imgtoolerr_t mac_image_freespace(imgtool_partition *partition, UINT64 *size);
|
||||
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);
|
||||
static imgtoolerr_t mac_image_beginenum(imgtool::directory *enumeration, const char *path);
|
||||
static imgtoolerr_t mac_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent);
|
||||
static imgtoolerr_t mac_image_freespace(imgtool::partition *partition, UINT64 *size);
|
||||
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
|
||||
/*
|
||||
@ -5336,10 +5336,10 @@ struct mac_iterator
|
||||
/*
|
||||
Open the disk catalog for enumeration
|
||||
*/
|
||||
static imgtoolerr_t mac_image_beginenum(imgtool_directory *enumeration, const char *path)
|
||||
static imgtoolerr_t mac_image_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
{
|
||||
struct mac_l2_imgref *image = get_imgref(imgtool_directory_image(enumeration));
|
||||
mac_iterator *iter = (mac_iterator *) imgtool_directory_extrabytes(enumeration);
|
||||
struct mac_l2_imgref *image = get_imgref(&enumeration->image());
|
||||
mac_iterator *iter = (mac_iterator *) enumeration->extra_bytes();
|
||||
imgtoolerr_t err = IMGTOOLERR_UNEXPECTED;
|
||||
|
||||
iter->format = image->format;
|
||||
@ -5545,10 +5545,10 @@ static imgtoolerr_t hfs_image_nextenum(mac_iterator *iter, imgtool_dirent *ent)
|
||||
/*
|
||||
Enumerate disk catalog next entry
|
||||
*/
|
||||
static imgtoolerr_t mac_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t mac_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
mac_iterator *iter = (mac_iterator *) imgtool_directory_extrabytes(enumeration);
|
||||
mac_iterator *iter = (mac_iterator *) enumeration->extra_bytes();
|
||||
|
||||
switch (iter->format)
|
||||
{
|
||||
@ -5571,9 +5571,9 @@ static imgtoolerr_t mac_image_nextenum(imgtool_directory *enumeration, imgtool_d
|
||||
/*
|
||||
Compute free space on disk image in bytes
|
||||
*/
|
||||
static imgtoolerr_t mac_image_freespace(imgtool_partition *partition, UINT64 *size)
|
||||
static imgtoolerr_t mac_image_freespace(imgtool::partition *partition, UINT64 *size)
|
||||
{
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
*size = ((UINT64) get_imgref(image)->freeABs) * 512;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
@ -5610,10 +5610,10 @@ static imgtoolerr_t mac_get_comment(struct mac_l2_imgref *image, mac_str255 file
|
||||
/*
|
||||
Extract a file from a disk image.
|
||||
*/
|
||||
static imgtoolerr_t mac_image_readfile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t mac_image_readfile(imgtool::partition *partition, const char *fpath, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
struct mac_l2_imgref *image = get_imgref(img);
|
||||
UINT32 parID;
|
||||
mac_str255 filename;
|
||||
@ -5661,9 +5661,9 @@ static imgtoolerr_t mac_image_readfile(imgtool_partition *partition, const char
|
||||
/*
|
||||
Add a file to a disk image.
|
||||
*/
|
||||
static imgtoolerr_t mac_image_writefile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *sourcef, util::option_resolution *writeoptions)
|
||||
static imgtoolerr_t mac_image_writefile(imgtool::partition *partition, const char *fpath, const char *fork, imgtool_stream *sourcef, util::option_resolution *writeoptions)
|
||||
{
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
struct mac_l2_imgref *image = get_imgref(img);
|
||||
UINT32 parID;
|
||||
mac_str255 filename;
|
||||
@ -5738,14 +5738,14 @@ static imgtoolerr_t mac_image_writefile(imgtool_partition *partition, const char
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t mac_image_listforks(imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len)
|
||||
static imgtoolerr_t mac_image_listforks(imgtool::partition *partition, const char *path, imgtool_forkent *ents, size_t len)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
UINT32 parID;
|
||||
mac_str255 filename;
|
||||
mac_dirent cat_info;
|
||||
int fork_num = 0;
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
struct mac_l2_imgref *image = get_imgref(img);
|
||||
|
||||
/* resolve path and fetch file info from directory/catalog */
|
||||
@ -5776,10 +5776,10 @@ static imgtoolerr_t mac_image_listforks(imgtool_partition *partition, const char
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t mac_image_getattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values)
|
||||
static imgtoolerr_t mac_image_getattrs(imgtool::partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
UINT32 parID;
|
||||
mac_str255 filename;
|
||||
mac_dirent cat_info;
|
||||
@ -5844,13 +5844,13 @@ static imgtoolerr_t mac_image_getattrs(imgtool_partition *partition, const char
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t mac_image_setattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values)
|
||||
static imgtoolerr_t mac_image_setattrs(imgtool::partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
UINT32 parID;
|
||||
mac_str255 filename;
|
||||
mac_dirent cat_info;
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
struct mac_l2_imgref *image = get_imgref(img);
|
||||
int i;
|
||||
|
||||
@ -6111,7 +6111,7 @@ static int load_icon(UINT32 *dest, const void *resource_fork, UINT64 resource_fo
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t mac_image_geticoninfo(imgtool_partition *partition, const char *path, imgtool_iconinfo *iconinfo)
|
||||
static imgtoolerr_t mac_image_geticoninfo(imgtool::partition *partition, const char *path, imgtool_iconinfo *iconinfo)
|
||||
{
|
||||
static const UINT32 mac_palette_1bpp[2] = { 0xFFFFFF, 0x000000 };
|
||||
|
||||
@ -6317,13 +6317,13 @@ done:
|
||||
*
|
||||
*************************************/
|
||||
|
||||
static imgtoolerr_t mac_image_suggesttransfer(imgtool_partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length)
|
||||
static imgtoolerr_t mac_image_suggesttransfer(imgtool::partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
UINT32 parID;
|
||||
mac_str255 filename;
|
||||
mac_dirent cat_info;
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
struct mac_l2_imgref *image = get_imgref(img);
|
||||
mac_filecategory_t file_category = MAC_FILECATEGORY_DATA;
|
||||
|
||||
|
@ -63,7 +63,7 @@ static UINT32 pad128(UINT32 length)
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t macbinary_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t macbinary_readfile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
static const UINT32 attrs[] =
|
||||
{
|
||||
@ -101,7 +101,7 @@ static imgtoolerr_t macbinary_readfile(imgtool_partition *partition, const char
|
||||
imgtool_attribute attr_values[10];
|
||||
|
||||
/* get the forks */
|
||||
err = imgtool_partition_list_file_forks(partition, filename, fork_entries, sizeof(fork_entries));
|
||||
err = partition->list_file_forks(filename, fork_entries, sizeof(fork_entries));
|
||||
if (err)
|
||||
return err;
|
||||
for (i = 0; fork_entries[i].type != FORK_END; i++)
|
||||
@ -113,7 +113,7 @@ static imgtoolerr_t macbinary_readfile(imgtool_partition *partition, const char
|
||||
}
|
||||
|
||||
/* get the attributes */
|
||||
err = imgtool_partition_get_file_attributes(partition, filename, attrs, attr_values);
|
||||
err = partition->get_file_attributes(filename, attrs, attr_values);
|
||||
if (err && (ERRORCODE(err) != IMGTOOLERR_UNIMPLEMENTED))
|
||||
return err;
|
||||
if (err == IMGTOOLERR_SUCCESS)
|
||||
@ -160,7 +160,7 @@ static imgtoolerr_t macbinary_readfile(imgtool_partition *partition, const char
|
||||
|
||||
if (data_fork)
|
||||
{
|
||||
err = imgtool_partition_read_file(partition, filename, "", destf, NULL);
|
||||
err = partition->read_file(filename, "", destf, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@ -169,7 +169,7 @@ static imgtoolerr_t macbinary_readfile(imgtool_partition *partition, const char
|
||||
|
||||
if (resource_fork)
|
||||
{
|
||||
err = imgtool_partition_read_file(partition, filename, "RESOURCE_FORK", destf, NULL);
|
||||
err = partition->read_file(filename, "RESOURCE_FORK", destf, NULL);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@ -181,7 +181,7 @@ static imgtoolerr_t macbinary_readfile(imgtool_partition *partition, const char
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t write_fork(imgtool_partition *partition, const char *filename, const char *fork,
|
||||
static imgtoolerr_t write_fork(imgtool::partition *partition, const char *filename, const char *fork,
|
||||
imgtool_stream *sourcef, UINT64 pos, UINT64 fork_len, util::option_resolution *opts)
|
||||
{
|
||||
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
|
||||
@ -203,7 +203,7 @@ static imgtoolerr_t write_fork(imgtool_partition *partition, const char *filenam
|
||||
stream_fill(mem_stream, 0, fork_len);
|
||||
|
||||
stream_seek(mem_stream, 0, SEEK_SET);
|
||||
err = imgtool_partition_write_file(partition, filename, fork, mem_stream, opts, NULL);
|
||||
err = partition->write_file(filename, fork, mem_stream, opts, NULL);
|
||||
if (err)
|
||||
goto done;
|
||||
}
|
||||
@ -216,7 +216,7 @@ done:
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t macbinary_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
static imgtoolerr_t macbinary_writefile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
static const UINT32 attrs[] =
|
||||
{
|
||||
@ -233,7 +233,7 @@ static imgtoolerr_t macbinary_writefile(imgtool_partition *partition, const char
|
||||
0
|
||||
};
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
UINT8 header[128];
|
||||
UINT32 datafork_size;
|
||||
UINT32 resourcefork_size;
|
||||
@ -332,7 +332,7 @@ static imgtoolerr_t macbinary_writefile(imgtool_partition *partition, const char
|
||||
attr_values[8].i = script_code;
|
||||
attr_values[9].i = extended_flags;
|
||||
|
||||
err = imgtool_partition_put_file_attributes(partition, filename, attrs, attr_values);
|
||||
err = partition->put_file_attributes(filename, attrs, attr_values);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
@ -125,9 +125,9 @@ static os9_diskinfo *os9_get_diskinfo(imgtool::image *image)
|
||||
|
||||
|
||||
|
||||
static struct os9_direnum *os9_get_dirinfo(imgtool_directory *directory)
|
||||
static struct os9_direnum *os9_get_dirinfo(imgtool::directory *directory)
|
||||
{
|
||||
return (struct os9_direnum *) imgtool_directory_extrabytes(directory);
|
||||
return (struct os9_direnum *) directory->extra_bytes();
|
||||
}
|
||||
|
||||
|
||||
@ -847,13 +847,13 @@ done:
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t os9_diskimage_beginenum(imgtool_directory *enumeration, const char *path)
|
||||
static imgtoolerr_t os9_diskimage_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
{
|
||||
imgtoolerr_t err = IMGTOOLERR_SUCCESS;
|
||||
struct os9_direnum *os9enum;
|
||||
imgtool::image *image;
|
||||
|
||||
image = imgtool_directory_image(enumeration);
|
||||
image = &enumeration->image();
|
||||
os9enum = os9_get_dirinfo(enumeration);
|
||||
|
||||
err = os9_lookup_path(image, path, CREATE_NONE, &os9enum->dir_info, NULL, NULL, NULL);
|
||||
@ -873,7 +873,7 @@ done:
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t os9_diskimage_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t os9_diskimage_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
{
|
||||
struct os9_direnum *os9enum;
|
||||
UINT32 lsn, index;
|
||||
@ -883,7 +883,7 @@ static imgtoolerr_t os9_diskimage_nextenum(imgtool_directory *enumeration, imgto
|
||||
struct os9_fileinfo file_info;
|
||||
imgtool::image *image;
|
||||
|
||||
image = imgtool_directory_image(enumeration);
|
||||
image = &enumeration->image();
|
||||
os9enum = os9_get_dirinfo(enumeration);
|
||||
|
||||
do
|
||||
@ -949,7 +949,7 @@ static imgtoolerr_t os9_diskimage_nextenum(imgtool_directory *enumeration, imgto
|
||||
|
||||
/* read file attributes */
|
||||
lsn = pick_integer_be(dir_entry, 29, 3);
|
||||
err = os9_decode_file_header(imgtool_directory_image(enumeration), lsn, &file_info);
|
||||
err = os9_decode_file_header(&enumeration->image(), lsn, &file_info);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
@ -973,9 +973,9 @@ static imgtoolerr_t os9_diskimage_nextenum(imgtool_directory *enumeration, imgto
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t os9_diskimage_freespace(imgtool_partition *partition, UINT64 *size)
|
||||
static imgtoolerr_t os9_diskimage_freespace(imgtool::partition *partition, UINT64 *size)
|
||||
{
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
const os9_diskinfo *disk_info;
|
||||
UINT32 free_lsns;
|
||||
|
||||
@ -988,10 +988,10 @@ static imgtoolerr_t os9_diskimage_freespace(imgtool_partition *partition, UINT64
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t os9_diskimage_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t os9_diskimage_readfile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
const os9_diskinfo *disk_info;
|
||||
struct os9_fileinfo file_info;
|
||||
UINT8 buffer[256];
|
||||
@ -1026,10 +1026,10 @@ static imgtoolerr_t os9_diskimage_readfile(imgtool_partition *partition, const c
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t os9_diskimage_writefile(imgtool_partition *partition, const char *path, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
static imgtoolerr_t os9_diskimage_writefile(imgtool::partition *partition, const char *path, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
struct os9_fileinfo file_info;
|
||||
size_t write_size;
|
||||
dynamic_buffer buf;
|
||||
@ -1081,11 +1081,11 @@ done:
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t os9_diskimage_delete(imgtool_partition *partition, const char *path,
|
||||
static imgtoolerr_t os9_diskimage_delete(imgtool::partition *partition, const char *path,
|
||||
unsigned int delete_directory)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
//const os9_diskinfo *disk_info;
|
||||
struct os9_fileinfo file_info;
|
||||
UINT32 dirent_lsn, dirent_index;
|
||||
@ -1163,17 +1163,17 @@ static imgtoolerr_t os9_diskimage_delete(imgtool_partition *partition, const cha
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t os9_diskimage_deletefile(imgtool_partition *partition, const char *path)
|
||||
static imgtoolerr_t os9_diskimage_deletefile(imgtool::partition *partition, const char *path)
|
||||
{
|
||||
return os9_diskimage_delete(partition, path, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t os9_diskimage_createdir(imgtool_partition *partition, const char *path)
|
||||
static imgtoolerr_t os9_diskimage_createdir(imgtool::partition *partition, const char *path)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
struct os9_fileinfo file_info;
|
||||
UINT8 dir_data[64];
|
||||
UINT32 parent_lsn;
|
||||
@ -1203,7 +1203,7 @@ done:
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t os9_diskimage_deletedir(imgtool_partition *partition, const char *path)
|
||||
static imgtoolerr_t os9_diskimage_deletedir(imgtool::partition *partition, const char *path)
|
||||
{
|
||||
return os9_diskimage_delete(partition, path, 1);
|
||||
}
|
||||
|
@ -1486,7 +1486,7 @@ static UINT32 prodos_get_storagetype_maxfilesize(UINT8 storage_type)
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t prodos_diskimage_beginenum(imgtool_directory *enumeration, const char *path)
|
||||
static imgtoolerr_t prodos_diskimage_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image;
|
||||
@ -1494,8 +1494,8 @@ static imgtoolerr_t prodos_diskimage_beginenum(imgtool_directory *enumeration, c
|
||||
prodos_dirent ent;
|
||||
UINT16 block = ROOTDIR_BLOCK;
|
||||
|
||||
image = imgtool_directory_image(enumeration);
|
||||
appleenum = (prodos_direnum *) imgtool_directory_extrabytes(enumeration);
|
||||
image = &enumeration->image();
|
||||
appleenum = (prodos_direnum *) enumeration->extra_bytes();
|
||||
|
||||
/* find subdirectory, if appropriate */
|
||||
if (*path)
|
||||
@ -1521,7 +1521,7 @@ static imgtoolerr_t prodos_diskimage_beginenum(imgtool_directory *enumeration, c
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t prodos_diskimage_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t prodos_diskimage_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image;
|
||||
@ -1529,8 +1529,8 @@ static imgtoolerr_t prodos_diskimage_nextenum(imgtool_directory *enumeration, im
|
||||
prodos_dirent pd_ent;
|
||||
UINT32 max_filesize;
|
||||
|
||||
image = imgtool_directory_image(enumeration);
|
||||
appleenum = (prodos_direnum *) imgtool_directory_extrabytes(enumeration);
|
||||
image = &enumeration->image();
|
||||
appleenum = (prodos_direnum *) enumeration->extra_bytes();
|
||||
|
||||
do
|
||||
{
|
||||
@ -1675,10 +1675,10 @@ static imgtoolerr_t prodos_write_file_tree(imgtool::image *image, UINT32 *filesi
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t prodos_diskimage_freespace(imgtool_partition *partition, UINT64 *size)
|
||||
static imgtoolerr_t prodos_diskimage_freespace(imgtool::partition *partition, UINT64 *size)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
prodos_diskinfo *di;
|
||||
UINT8 *bitmap = NULL;
|
||||
UINT16 i;
|
||||
@ -1704,10 +1704,10 @@ done:
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t prodos_diskimage_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t prodos_diskimage_readfile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
prodos_dirent ent;
|
||||
UINT16 key_pointer;
|
||||
int nest_level;
|
||||
@ -1744,10 +1744,10 @@ static imgtoolerr_t prodos_diskimage_readfile(imgtool_partition *partition, cons
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t prodos_diskimage_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
static imgtoolerr_t prodos_diskimage_writefile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
prodos_dirent ent;
|
||||
prodos_direnum direnum;
|
||||
UINT64 file_size;
|
||||
@ -1782,10 +1782,10 @@ static imgtoolerr_t prodos_diskimage_writefile(imgtool_partition *partition, con
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t prodos_diskimage_deletefile(imgtool_partition *partition, const char *path)
|
||||
static imgtoolerr_t prodos_diskimage_deletefile(imgtool::partition *partition, const char *path)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
prodos_dirent ent;
|
||||
prodos_direnum direnum;
|
||||
|
||||
@ -1815,10 +1815,10 @@ static imgtoolerr_t prodos_diskimage_deletefile(imgtool_partition *partition, co
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t prodos_diskimage_listforks(imgtool_partition *partition, const char *path, imgtool_forkent *ents, size_t len)
|
||||
static imgtoolerr_t prodos_diskimage_listforks(imgtool::partition *partition, const char *path, imgtool_forkent *ents, size_t len)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
prodos_dirent ent;
|
||||
prodos_direnum direnum;
|
||||
int fork_num = 0;
|
||||
@ -1851,10 +1851,10 @@ static imgtoolerr_t prodos_diskimage_listforks(imgtool_partition *partition, con
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t prodos_diskimage_createdir(imgtool_partition *partition, const char *path)
|
||||
static imgtoolerr_t prodos_diskimage_createdir(imgtool::partition *partition, const char *path)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
prodos_dirent ent;
|
||||
prodos_direnum direnum;
|
||||
|
||||
@ -1909,10 +1909,10 @@ static imgtoolerr_t prodos_free_directory(imgtool::image *image, UINT8 *volume_b
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t prodos_diskimage_deletedir(imgtool_partition *partition, const char *path)
|
||||
static imgtoolerr_t prodos_diskimage_deletedir(imgtool::partition *partition, const char *path)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
prodos_dirent ent;
|
||||
prodos_direnum direnum;
|
||||
UINT8 *volume_bitmap = NULL;
|
||||
@ -1999,10 +1999,10 @@ static imgtoolerr_t prodos_get_file_tree(imgtool::image *image, imgtool_chainent
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t prodos_diskimage_getattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values)
|
||||
static imgtoolerr_t prodos_diskimage_getattrs(imgtool::partition *partition, const char *path, const UINT32 *attrs, imgtool_attribute *values)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
prodos_dirent ent;
|
||||
int i;
|
||||
|
||||
@ -2062,10 +2062,10 @@ static imgtoolerr_t prodos_diskimage_getattrs(imgtool_partition *partition, cons
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t prodos_diskimage_setattrs(imgtool_partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values)
|
||||
static imgtoolerr_t prodos_diskimage_setattrs(imgtool::partition *partition, const char *path, const UINT32 *attrs, const imgtool_attribute *values)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
prodos_dirent ent;
|
||||
prodos_direnum direnum;
|
||||
int i;
|
||||
@ -2130,10 +2130,10 @@ static imgtoolerr_t prodos_diskimage_setattrs(imgtool_partition *partition, cons
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t prodos_diskimage_suggesttransfer(imgtool_partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length)
|
||||
static imgtoolerr_t prodos_diskimage_suggesttransfer(imgtool::partition *partition, const char *path, imgtool_transfer_suggestion *suggestions, size_t suggestions_length)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
prodos_dirent ent;
|
||||
mac_filecategory_t file_category = MAC_FILECATEGORY_DATA;
|
||||
|
||||
@ -2153,10 +2153,10 @@ static imgtoolerr_t prodos_diskimage_suggesttransfer(imgtool_partition *partitio
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t prodos_diskimage_getchain(imgtool_partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size)
|
||||
static imgtoolerr_t prodos_diskimage_getchain(imgtool::partition *partition, const char *path, imgtool_chainent *chain, size_t chain_size)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
prodos_dirent ent;
|
||||
size_t chain_pos = 0;
|
||||
int fork_num;
|
||||
|
@ -447,19 +447,19 @@ static void datapack_close( imgtool::image *image)
|
||||
stream_close( pack->stream );
|
||||
}
|
||||
|
||||
static imgtoolerr_t datapack_begin_enum(imgtool_directory *enumeration, const char *path)
|
||||
static imgtoolerr_t datapack_begin_enum(imgtool::directory *enumeration, const char *path)
|
||||
{
|
||||
psion_iter *iter = (psion_iter*)imgtool_directory_extrabytes(enumeration);
|
||||
psion_iter *iter = (psion_iter*)enumeration->extra_bytes();
|
||||
iter->index = 0;
|
||||
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t datapack_next_enum(imgtool_directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t datapack_next_enum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
{
|
||||
imgtool::image *image = imgtool_directory_image(enumeration);
|
||||
imgtool::image *image = &enumeration->image();
|
||||
psion_pack *pack = (psion_pack*)image->extra_bytes();
|
||||
psion_iter *iter = (psion_iter*)imgtool_directory_extrabytes(enumeration);
|
||||
psion_iter *iter = (psion_iter*)enumeration->extra_bytes();
|
||||
UINT8 data = 0;
|
||||
|
||||
if (!pack->pack_index[iter->index].name_rec)
|
||||
@ -492,13 +492,13 @@ static imgtoolerr_t datapack_next_enum(imgtool_directory *enumeration, imgtool_d
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static void datapack_close_enum( imgtool_directory *enumeration)
|
||||
static void datapack_close_enum( imgtool::directory *enumeration)
|
||||
{
|
||||
}
|
||||
|
||||
static imgtoolerr_t datapack_free_space( imgtool_partition *partition, UINT64 *size)
|
||||
static imgtoolerr_t datapack_free_space( imgtool::partition *partition, UINT64 *size)
|
||||
{
|
||||
imgtool::image *image = imgtool_partition_image( partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
psion_pack *pack = (psion_pack*)image->extra_bytes();
|
||||
UINT32 pack_size = 0;
|
||||
|
||||
@ -511,9 +511,9 @@ static imgtoolerr_t datapack_free_space( imgtool_partition *partition, UINT64 *s
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t datapack_read_file(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t datapack_read_file(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
psion_pack *pack = (psion_pack*)image->extra_bytes();
|
||||
int index = seek_file_name(pack, filename);
|
||||
|
||||
@ -543,9 +543,9 @@ static imgtoolerr_t datapack_read_file(imgtool_partition *partition, const char
|
||||
return IMGTOOLERR_FILENOTFOUND;
|
||||
}
|
||||
|
||||
static imgtoolerr_t datapack_write_file( imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
static imgtoolerr_t datapack_write_file( imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
psion_pack *pack = (psion_pack*)image->extra_bytes();
|
||||
static const UINT8 data_head[4] = {0x02, 0x80, 0x00, 0x00};
|
||||
UINT8 head[3];
|
||||
@ -605,9 +605,9 @@ static imgtoolerr_t datapack_write_file( imgtool_partition *partition, const cha
|
||||
return IMGTOOLERR_CORRUPTIMAGE;
|
||||
}
|
||||
|
||||
static imgtoolerr_t datapack_delete_file( imgtool_partition *partition, const char *filename)
|
||||
static imgtoolerr_t datapack_delete_file( imgtool::partition *partition, const char *filename)
|
||||
{
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
psion_pack *pack = (psion_pack*)image->extra_bytes();
|
||||
int index = seek_file_name(pack, filename);
|
||||
|
||||
|
@ -262,7 +262,7 @@ static imgtoolerr_t prepare_dirent(struct rsdos_dirent *ent, const char *fname)
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t rsdos_diskimage_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t rsdos_diskimage_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
{
|
||||
floperr_t ferr;
|
||||
imgtoolerr_t err;
|
||||
@ -272,8 +272,8 @@ static imgtoolerr_t rsdos_diskimage_nextenum(imgtool_directory *enumeration, img
|
||||
char fname[13];
|
||||
imgtool::image *image;
|
||||
|
||||
image = imgtool_directory_image(enumeration);
|
||||
rsenum = (struct rsdos_direnum *) imgtool_directory_extrabytes(enumeration);
|
||||
image = &enumeration->image();
|
||||
rsenum = (struct rsdos_direnum *) enumeration->extra_bytes();
|
||||
|
||||
/* Did we hit the end of file before? */
|
||||
if (rsenum->eof)
|
||||
@ -327,14 +327,14 @@ eof:
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t rsdos_diskimage_freespace(imgtool_partition *partition, UINT64 *size)
|
||||
static imgtoolerr_t rsdos_diskimage_freespace(imgtool::partition *partition, UINT64 *size)
|
||||
{
|
||||
floperr_t ferr;
|
||||
UINT8 i;
|
||||
size_t s = 0;
|
||||
UINT8 granule_count;
|
||||
UINT8 granule_map[MAX_GRANULEMAP_SIZE];
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
|
||||
ferr = get_granule_map(image, granule_map, &granule_count);
|
||||
if (ferr)
|
||||
@ -386,12 +386,12 @@ static imgtoolerr_t delete_entry(imgtool::image *img, struct rsdos_dirent *ent,
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t rsdos_diskimage_readfile(imgtool_partition *partition, const char *fname, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t rsdos_diskimage_readfile(imgtool::partition *partition, const char *fname, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
struct rsdos_dirent ent;
|
||||
size_t size;
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
|
||||
err = lookup_rsdos_file(img, fname, &ent, NULL);
|
||||
if (err)
|
||||
@ -409,11 +409,11 @@ static imgtoolerr_t rsdos_diskimage_readfile(imgtool_partition *partition, const
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t rsdos_diskimage_writefile(imgtool_partition *partition, const char *fname, const char *fork, imgtool_stream *sourcef, util::option_resolution *writeoptions)
|
||||
static imgtoolerr_t rsdos_diskimage_writefile(imgtool::partition *partition, const char *fname, const char *fork, imgtool_stream *sourcef, util::option_resolution *writeoptions)
|
||||
{
|
||||
floperr_t ferr;
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
struct rsdos_dirent ent, ent2;
|
||||
size_t i;
|
||||
UINT64 sz;
|
||||
@ -514,10 +514,10 @@ static imgtoolerr_t rsdos_diskimage_writefile(imgtool_partition *partition, cons
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t rsdos_diskimage_deletefile(imgtool_partition *partition, const char *fname)
|
||||
static imgtoolerr_t rsdos_diskimage_deletefile(imgtool::partition *partition, const char *fname)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
int pos;
|
||||
struct rsdos_dirent ent;
|
||||
|
||||
@ -530,10 +530,10 @@ static imgtoolerr_t rsdos_diskimage_deletefile(imgtool_partition *partition, con
|
||||
|
||||
|
||||
|
||||
static imgtoolerr_t rsdos_diskimage_suggesttransfer(imgtool_partition *partition, const char *fname, imgtool_transfer_suggestion *suggestions, size_t suggestions_length)
|
||||
static imgtoolerr_t rsdos_diskimage_suggesttransfer(imgtool::partition *partition, const char *fname, imgtool_transfer_suggestion *suggestions, size_t suggestions_length)
|
||||
{
|
||||
imgtoolerr_t err;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
struct rsdos_dirent ent;
|
||||
int pos;
|
||||
|
||||
|
@ -866,34 +866,34 @@ static imgtoolerr_t thom_list_partitions(imgtool::image *img,
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t thom_open_partition(imgtool_partition *part,
|
||||
static imgtoolerr_t thom_open_partition(imgtool::partition *part,
|
||||
UINT64 first_block, UINT64 block_count)
|
||||
{
|
||||
imgtool::image* img = imgtool_partition_image( part );
|
||||
imgtool::image* img = &part->image();
|
||||
thom_floppy* f = (thom_floppy*) img->extra_bytes();
|
||||
if ( first_block >= f->heads )
|
||||
return IMGTOOLERR_INVALIDPARTITION;
|
||||
* ( (int*) imgtool_partition_extra_bytes( part ) ) = first_block;
|
||||
* ( (int*) part->extra_bytes() ) = first_block;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
static imgtoolerr_t thom_begin_enum(imgtool_directory *enumeration,
|
||||
static imgtoolerr_t thom_begin_enum(imgtool::directory *enumeration,
|
||||
const char *path)
|
||||
{
|
||||
int* n = (int*) imgtool_directory_extrabytes( enumeration );
|
||||
int* n = (int*) enumeration->extra_bytes();
|
||||
*n = 0;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t thom_next_enum(imgtool_directory *enumeration,
|
||||
static imgtoolerr_t thom_next_enum(imgtool::directory *enumeration,
|
||||
imgtool_dirent *ent)
|
||||
{
|
||||
imgtool_partition *part = imgtool_directory_partition( enumeration);
|
||||
int head = *( (int*) imgtool_partition_extra_bytes( part ) );
|
||||
imgtool::image* img = imgtool_partition_image( part );
|
||||
imgtool::partition *part = &enumeration->partition();
|
||||
int head = *( (int*) part->extra_bytes() );
|
||||
imgtool::image* img = &part->image();
|
||||
thom_floppy* f = (thom_floppy*) img->extra_bytes();
|
||||
int* n = (int*) imgtool_directory_extrabytes( enumeration );
|
||||
int* n = (int*) enumeration->extra_bytes();
|
||||
thom_dirent d;
|
||||
|
||||
do {
|
||||
@ -924,23 +924,23 @@ static imgtoolerr_t thom_next_enum(imgtool_directory *enumeration,
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t thom_free_space(imgtool_partition *part, UINT64 *size)
|
||||
static imgtoolerr_t thom_free_space(imgtool::partition *part, UINT64 *size)
|
||||
{
|
||||
int head = *( (int*) imgtool_partition_extra_bytes( part ) );
|
||||
imgtool::image* img = imgtool_partition_image( part );
|
||||
int head = *( (int*) part->extra_bytes() );
|
||||
imgtool::image* img = &part->image();
|
||||
thom_floppy* f = (thom_floppy*) img->extra_bytes();
|
||||
int nb = thom_get_free_blocks( f, head );
|
||||
(*size) = nb * f->sectuse_size * 8;
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t thom_read_file(imgtool_partition *part,
|
||||
static imgtoolerr_t thom_read_file(imgtool::partition *part,
|
||||
const char *filename,
|
||||
const char *fork,
|
||||
imgtool_stream *destf)
|
||||
{
|
||||
int head = *( (int*) imgtool_partition_extra_bytes( part ) );
|
||||
imgtool::image* img = imgtool_partition_image( part );
|
||||
int head = *( (int*) part->extra_bytes() );
|
||||
imgtool::image* img = &part->image();
|
||||
thom_floppy* f = (thom_floppy*) img->extra_bytes();
|
||||
thom_dirent d;
|
||||
char name[9], ext[4], fname[14];
|
||||
@ -958,11 +958,11 @@ static imgtoolerr_t thom_read_file(imgtool_partition *part,
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t thom_delete_file(imgtool_partition *part,
|
||||
static imgtoolerr_t thom_delete_file(imgtool::partition *part,
|
||||
const char *filename)
|
||||
{
|
||||
int head = *( (int*) imgtool_partition_extra_bytes( part ) );
|
||||
imgtool::image* img = imgtool_partition_image( part );
|
||||
int head = *( (int*) part->extra_bytes() );
|
||||
imgtool::image* img = &part->image();
|
||||
thom_floppy* f = (thom_floppy*) img->extra_bytes();
|
||||
thom_dirent d;
|
||||
char name[9], ext[4], fname[14];
|
||||
@ -979,14 +979,14 @@ static imgtoolerr_t thom_delete_file(imgtool_partition *part,
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t thom_write_file(imgtool_partition *part,
|
||||
static imgtoolerr_t thom_write_file(imgtool::partition *part,
|
||||
const char *filename,
|
||||
const char *fork,
|
||||
imgtool_stream *sourcef,
|
||||
util::option_resolution *opts)
|
||||
{
|
||||
int head = *( (int*) imgtool_partition_extra_bytes( part ) );
|
||||
imgtool::image* img = imgtool_partition_image( part );
|
||||
int head = *( (int*) part->extra_bytes() );
|
||||
imgtool::image* img = &part->image();
|
||||
thom_floppy* f = (thom_floppy*) img->extra_bytes();
|
||||
thom_dirent d;
|
||||
int size = stream_size( sourcef );
|
||||
@ -1063,13 +1063,13 @@ static imgtoolerr_t thom_write_file(imgtool_partition *part,
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t thom_suggest_transfer(imgtool_partition *part,
|
||||
static imgtoolerr_t thom_suggest_transfer(imgtool::partition *part,
|
||||
const char *fname,
|
||||
imgtool_transfer_suggestion *suggestions,
|
||||
size_t suggestions_length)
|
||||
{
|
||||
int head = *( (int*) imgtool_partition_extra_bytes( part ) );
|
||||
imgtool::image* img = imgtool_partition_image( part );
|
||||
int head = *( (int*) part->extra_bytes() );
|
||||
imgtool::image* img = &part->image();
|
||||
thom_floppy* f = (thom_floppy*) img->extra_bytes();
|
||||
thom_dirent d;
|
||||
int is_basic = 0;
|
||||
@ -1303,7 +1303,7 @@ static void thom_encrypt(imgtool_stream* out, imgtool_stream* in)
|
||||
}
|
||||
}
|
||||
|
||||
static imgtoolerr_t thomcrypt_read_file(imgtool_partition *part,
|
||||
static imgtoolerr_t thomcrypt_read_file(imgtool::partition *part,
|
||||
const char *name,
|
||||
const char *fork, imgtool_stream *dst)
|
||||
{
|
||||
@ -1336,7 +1336,7 @@ static imgtoolerr_t thomcrypt_read_file(imgtool_partition *part,
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t thomcrypt_write_file(imgtool_partition *part,
|
||||
static imgtoolerr_t thomcrypt_write_file(imgtool::partition *part,
|
||||
const char *name,
|
||||
const char *fork, imgtool_stream *src,
|
||||
util::option_resolution *opts)
|
||||
@ -1382,7 +1382,7 @@ void filter_thomcrypt_getinfo(UINT32 state, union filterinfo *info)
|
||||
}
|
||||
|
||||
/* untokenization automatically decrypt protected files */
|
||||
static imgtoolerr_t thom_basic_read_file(imgtool_partition *part,
|
||||
static imgtoolerr_t thom_basic_read_file(imgtool::partition *part,
|
||||
const char *name,
|
||||
const char *fork,
|
||||
imgtool_stream *dst,
|
||||
@ -1452,7 +1452,7 @@ static imgtoolerr_t thom_basic_read_file(imgtool_partition *part,
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t thom_basic_write_file(imgtool_partition *part,
|
||||
static imgtoolerr_t thom_basic_write_file(imgtool::partition *part,
|
||||
const char *name,
|
||||
const char *fork,
|
||||
imgtool_stream *src,
|
||||
@ -1464,14 +1464,14 @@ static imgtoolerr_t thom_basic_write_file(imgtool_partition *part,
|
||||
|
||||
|
||||
#define FILTER(short,long) \
|
||||
static imgtoolerr_t short##_read_file(imgtool_partition *part, \
|
||||
static imgtoolerr_t short##_read_file(imgtool::partition *part, \
|
||||
const char *name, \
|
||||
const char *fork, \
|
||||
imgtool_stream *dst) \
|
||||
{ \
|
||||
return thom_basic_read_file( part, name, fork, dst, short ); \
|
||||
} \
|
||||
static imgtoolerr_t short##_write_file(imgtool_partition *part, \
|
||||
static imgtoolerr_t short##_write_file(imgtool::partition *part, \
|
||||
const char *name, \
|
||||
const char *fork, \
|
||||
imgtool_stream *src, \
|
||||
|
@ -3855,15 +3855,15 @@ static imgtoolerr_t dsk_image_init_pc99_mfm(imgtool::image *image, imgtool_strea
|
||||
static imgtoolerr_t win_image_init(imgtool::image *image, imgtool_stream *f);
|
||||
static void ti99_image_exit(imgtool::image *img);
|
||||
static void ti99_image_info(imgtool::image *img, char *string, size_t len);
|
||||
static imgtoolerr_t dsk_image_beginenum(imgtool_directory *enumeration, const char *path);
|
||||
static imgtoolerr_t dsk_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent);
|
||||
static imgtoolerr_t win_image_beginenum(imgtool_directory *enumeration, const char *path);
|
||||
static imgtoolerr_t win_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent);
|
||||
static imgtoolerr_t ti99_image_freespace(imgtool_partition *partition, UINT64 *size);
|
||||
static imgtoolerr_t ti99_image_readfile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *destf);
|
||||
static imgtoolerr_t ti99_image_writefile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *sourcef, util::option_resolution *writeoptions);
|
||||
static imgtoolerr_t dsk_image_deletefile(imgtool_partition *partition, const char *fpath);
|
||||
static imgtoolerr_t win_image_deletefile(imgtool_partition *partition, const char *fpath);
|
||||
static imgtoolerr_t dsk_image_beginenum(imgtool::directory *enumeration, const char *path);
|
||||
static imgtoolerr_t dsk_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent);
|
||||
static imgtoolerr_t win_image_beginenum(imgtool::directory *enumeration, const char *path);
|
||||
static imgtoolerr_t win_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent);
|
||||
static imgtoolerr_t ti99_image_freespace(imgtool::partition *partition, UINT64 *size);
|
||||
static imgtoolerr_t ti99_image_readfile(imgtool::partition *partition, const char *fpath, const char *fork, imgtool_stream *destf);
|
||||
static imgtoolerr_t ti99_image_writefile(imgtool::partition *partition, const char *fpath, const char *fork, imgtool_stream *sourcef, util::option_resolution *writeoptions);
|
||||
static imgtoolerr_t dsk_image_deletefile(imgtool::partition *partition, const char *fpath);
|
||||
static imgtoolerr_t win_image_deletefile(imgtool::partition *partition, const char *fpath);
|
||||
static imgtoolerr_t dsk_image_create_mess(imgtool::image *image, imgtool_stream *f, util::option_resolution *createoptions);
|
||||
static imgtoolerr_t dsk_image_create_v9t9(imgtool::image *image, imgtool_stream *f, util::option_resolution *createoptions);
|
||||
|
||||
@ -4209,10 +4209,10 @@ static void ti99_image_info(imgtool::image *img, char *string, size_t len)
|
||||
/*
|
||||
Open the disk catalog for enumeration
|
||||
*/
|
||||
static imgtoolerr_t dsk_image_beginenum(imgtool_directory *enumeration, const char *path)
|
||||
static imgtoolerr_t dsk_image_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
{
|
||||
struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_directory_image(enumeration)->extra_bytes();
|
||||
dsk_iterator *iter = (dsk_iterator *) imgtool_directory_extrabytes(enumeration);
|
||||
struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) enumeration->image().extra_bytes();
|
||||
dsk_iterator *iter = (dsk_iterator *) enumeration->extra_bytes();
|
||||
|
||||
iter->image = image;
|
||||
iter->level = 0;
|
||||
@ -4226,9 +4226,9 @@ static imgtoolerr_t dsk_image_beginenum(imgtool_directory *enumeration, const ch
|
||||
/*
|
||||
Enumerate disk catalog next entry
|
||||
*/
|
||||
static imgtoolerr_t dsk_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t dsk_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
{
|
||||
dsk_iterator *iter = (dsk_iterator*) imgtool_directory_extrabytes(enumeration);
|
||||
dsk_iterator *iter = (dsk_iterator*) enumeration->extra_bytes();
|
||||
dsk_fdr fdr;
|
||||
int reply;
|
||||
unsigned fdr_aphysrec;
|
||||
@ -4334,10 +4334,10 @@ static imgtoolerr_t dsk_image_nextenum(imgtool_directory *enumeration, imgtool_d
|
||||
/*
|
||||
Open the disk catalog for enumeration
|
||||
*/
|
||||
static imgtoolerr_t win_image_beginenum(imgtool_directory *enumeration, const char *path)
|
||||
static imgtoolerr_t win_image_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
{
|
||||
struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) imgtool_directory_image(enumeration)->extra_bytes();
|
||||
win_iterator *iter = (win_iterator *) imgtool_directory_extrabytes(enumeration);
|
||||
struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) enumeration->image().extra_bytes();
|
||||
win_iterator *iter = (win_iterator *) enumeration->extra_bytes();
|
||||
imgtoolerr_t errorcode;
|
||||
|
||||
iter->image = image;
|
||||
@ -4354,9 +4354,9 @@ static imgtoolerr_t win_image_beginenum(imgtool_directory *enumeration, const ch
|
||||
/*
|
||||
Enumerate disk catalog next entry
|
||||
*/
|
||||
static imgtoolerr_t win_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t win_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
{
|
||||
win_iterator *iter = (win_iterator *) imgtool_directory_extrabytes(enumeration);
|
||||
win_iterator *iter = (win_iterator *) enumeration->extra_bytes();
|
||||
unsigned fdr_aphysrec;
|
||||
win_fdr fdr;
|
||||
int reply;
|
||||
@ -4478,9 +4478,9 @@ static imgtoolerr_t win_image_nextenum(imgtool_directory *enumeration, imgtool_d
|
||||
/*
|
||||
Compute free space on disk image (in AUs)
|
||||
*/
|
||||
static imgtoolerr_t ti99_image_freespace(imgtool_partition *partition, UINT64 *size)
|
||||
static imgtoolerr_t ti99_image_freespace(imgtool::partition *partition, UINT64 *size)
|
||||
{
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) img->extra_bytes();
|
||||
size_t freeAUs;
|
||||
int i;
|
||||
@ -4502,9 +4502,9 @@ static imgtoolerr_t ti99_image_freespace(imgtool_partition *partition, UINT64 *s
|
||||
/*
|
||||
Extract a file from a ti99_image. The file is saved in tifile format.
|
||||
*/
|
||||
static imgtoolerr_t ti99_image_readfile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t ti99_image_readfile(imgtool::partition *partition, const char *fpath, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
#if 1
|
||||
|
||||
/* extract data as TIFILES */
|
||||
@ -4644,9 +4644,9 @@ static imgtoolerr_t ti99_image_readfile(imgtool_partition *partition, const char
|
||||
/*
|
||||
Add a file to a ti99_image. The file must be in tifile format.
|
||||
*/
|
||||
static imgtoolerr_t ti99_image_writefile(imgtool_partition *partition, const char *fpath, const char *fork, imgtool_stream *sourcef, util::option_resolution *writeoptions)
|
||||
static imgtoolerr_t ti99_image_writefile(imgtool::partition *partition, const char *fpath, const char *fork, imgtool_stream *sourcef, util::option_resolution *writeoptions)
|
||||
{
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) img->extra_bytes();
|
||||
const char *filename;
|
||||
char ti_fname[10];
|
||||
@ -4870,9 +4870,9 @@ static imgtoolerr_t ti99_image_writefile(imgtool_partition *partition, const cha
|
||||
/*
|
||||
Delete a file from a ti99_image.
|
||||
*/
|
||||
static imgtoolerr_t dsk_image_deletefile(imgtool_partition *partition, const char *fpath)
|
||||
static imgtoolerr_t dsk_image_deletefile(imgtool::partition *partition, const char *fpath)
|
||||
{
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) img->extra_bytes();
|
||||
dsk_fdr fdr;
|
||||
int i, cluster_index;
|
||||
@ -5012,9 +5012,9 @@ static imgtoolerr_t dsk_image_deletefile(imgtool_partition *partition, const cha
|
||||
return (imgtoolerr_t)0;
|
||||
}
|
||||
|
||||
static imgtoolerr_t win_image_deletefile(imgtool_partition *partition, const char *fpath)
|
||||
static imgtoolerr_t win_image_deletefile(imgtool::partition *partition, const char *fpath)
|
||||
{
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
struct ti99_lvl2_imgref *image = (struct ti99_lvl2_imgref *) img->extra_bytes();
|
||||
int parent_ddr_AU, is_dir, catalog_index;
|
||||
win_fdr fdr;
|
||||
|
@ -389,14 +389,14 @@ struct ti990_iterator
|
||||
static imgtoolerr_t ti990_image_init(imgtool::image *img, imgtool_stream *f);
|
||||
static void ti990_image_exit(imgtool::image *img);
|
||||
static void ti990_image_info(imgtool::image *img, char *string, size_t len);
|
||||
static imgtoolerr_t ti990_image_beginenum(imgtool_directory *enumeration, const char *path);
|
||||
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 *size);
|
||||
static imgtoolerr_t ti990_image_beginenum(imgtool::directory *enumeration, const char *path);
|
||||
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 *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);
|
||||
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
|
||||
static imgtoolerr_t ti990_image_create(imgtool::image *image, imgtool_stream *f, util::option_resolution *createoptions);
|
||||
|
||||
@ -1186,10 +1186,10 @@ static void ti990_image_info(imgtool::image *img, char *string, size_t len)
|
||||
/*
|
||||
Open the disk catalog for enumeration
|
||||
*/
|
||||
static imgtoolerr_t ti990_image_beginenum(imgtool_directory *enumeration, const char *path)
|
||||
static imgtoolerr_t ti990_image_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
{
|
||||
ti990_image *image = (ti990_image *) imgtool_directory_image(enumeration)->extra_bytes();
|
||||
ti990_iterator *iter = (ti990_iterator *) imgtool_directory_extrabytes(enumeration);
|
||||
ti990_image *image = (ti990_image *) enumeration->image().extra_bytes();
|
||||
ti990_iterator *iter = (ti990_iterator *) enumeration->extra_bytes();
|
||||
ti990_dor dor;
|
||||
int reply;
|
||||
|
||||
@ -1212,9 +1212,9 @@ static imgtoolerr_t ti990_image_beginenum(imgtool_directory *enumeration, const
|
||||
/*
|
||||
Enumerate disk catalog next entry
|
||||
*/
|
||||
static imgtoolerr_t ti990_image_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t ti990_image_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
{
|
||||
ti990_iterator *iter = (ti990_iterator *) imgtool_directory_extrabytes(enumeration);
|
||||
ti990_iterator *iter = (ti990_iterator *) enumeration->extra_bytes();
|
||||
int flag;
|
||||
int reply = 0;
|
||||
|
||||
@ -1406,16 +1406,16 @@ static imgtoolerr_t ti990_image_nextenum(imgtool_directory *enumeration, imgtool
|
||||
/*
|
||||
Free enumerator
|
||||
*/
|
||||
static void ti990_image_closeenum(imgtool_directory *enumeration)
|
||||
static void ti990_image_closeenum(imgtool::directory *enumeration)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
Compute free space on disk image (in ADUs)
|
||||
*/
|
||||
static imgtoolerr_t ti990_image_freespace(imgtool_partition *partition, UINT64 *size)
|
||||
static imgtoolerr_t ti990_image_freespace(imgtool::partition *partition, UINT64 *size)
|
||||
{
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
ti990_image *image = (ti990_image *) img->extra_bytes();
|
||||
int totadus = get_UINT16BE(image->sec0.tna);
|
||||
int adu, record, sub_adu;
|
||||
@ -1453,9 +1453,9 @@ static imgtoolerr_t ti990_image_freespace(imgtool_partition *partition, UINT64 *
|
||||
/*
|
||||
Extract a file from a ti990_image.
|
||||
*/
|
||||
static imgtoolerr_t ti990_image_readfile(imgtool_partition *partition, const char *fpath, imgtool_stream *destf)
|
||||
static imgtoolerr_t ti990_image_readfile(imgtool::partition *partition, const char *fpath, imgtool_stream *destf)
|
||||
{
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
ti990_image *image = (ti990_image *) img->extra_bytes();
|
||||
int catalog_index, fdr_secnum, parent_fdr_secnum;
|
||||
imgtoolerr_t reply;
|
||||
@ -1550,9 +1550,9 @@ static imgtoolerr_t ti990_image_readfile(imgtool_partition *partition, const cha
|
||||
/*
|
||||
Add a file to a ti990_image.
|
||||
*/
|
||||
static imgtoolerr_t ti990_image_writefile(imgtool_partition *partition, const char *fpath, imgtool_stream *sourcef, util::option_resolution *writeoptions)
|
||||
static imgtoolerr_t ti990_image_writefile(imgtool::partition *partition, const char *fpath, imgtool_stream *sourcef, util::option_resolution *writeoptions)
|
||||
{
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
ti990_image *image = (ti990_image *) img->extra_bytes();
|
||||
int catalog_index, fdr_secnum, parent_fdr_secnum;
|
||||
imgtoolerr_t reply;
|
||||
@ -1674,9 +1674,9 @@ static imgtoolerr_t ti990_image_writefile(imgtool_partition *partition, const ch
|
||||
/*
|
||||
Delete a file from a ti990_image.
|
||||
*/
|
||||
static imgtoolerr_t ti990_image_deletefile(imgtool_partition *partition, const char *fpath)
|
||||
static imgtoolerr_t ti990_image_deletefile(imgtool::partition *partition, const char *fpath)
|
||||
{
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
ti990_image *image = (ti990_image *) img->extra_bytes();
|
||||
int catalog_index, fdr_secnum, parent_fdr_secnum;
|
||||
imgtoolerr_t reply;
|
||||
|
@ -385,11 +385,11 @@ static imgtoolerr_t vzdos_write_formatted_sector(imgtool::image *img, int track,
|
||||
Imgtool module code
|
||||
*********************************************************************/
|
||||
|
||||
static imgtoolerr_t vzdos_diskimage_beginenum(imgtool_directory *enumeration, const char *path)
|
||||
static imgtoolerr_t vzdos_diskimage_beginenum(imgtool::directory *enumeration, const char *path)
|
||||
{
|
||||
vz_iterator *iter;
|
||||
|
||||
iter = (vz_iterator *) imgtool_directory_extrabytes(enumeration);
|
||||
iter = (vz_iterator *) enumeration->extra_bytes();
|
||||
if (!iter) return IMGTOOLERR_OUTOFMEMORY;
|
||||
|
||||
iter->index = 1;
|
||||
@ -398,9 +398,9 @@ static imgtoolerr_t vzdos_diskimage_beginenum(imgtool_directory *enumeration, co
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t vzdos_diskimage_nextenum(imgtool_directory *enumeration, imgtool_dirent *ent)
|
||||
static imgtoolerr_t vzdos_diskimage_nextenum(imgtool::directory *enumeration, imgtool_dirent *ent)
|
||||
{
|
||||
vz_iterator *iter = (vz_iterator *) imgtool_directory_extrabytes(enumeration);
|
||||
vz_iterator *iter = (vz_iterator *) enumeration->extra_bytes();
|
||||
|
||||
if (iter->eof == 1 || iter->index > MAX_DIRENTS) {
|
||||
ent->eof = 1;
|
||||
@ -410,7 +410,7 @@ static imgtoolerr_t vzdos_diskimage_nextenum(imgtool_directory *enumeration, img
|
||||
int ret, len;
|
||||
vzdos_dirent dirent;
|
||||
|
||||
ret = vzdos_get_dirent(imgtool_directory_image(enumeration), iter->index - 1, &dirent);
|
||||
ret = vzdos_get_dirent(&enumeration->image(), iter->index - 1, &dirent);
|
||||
|
||||
if (ret == IMGTOOLERR_FILENOTFOUND)
|
||||
{
|
||||
@ -455,11 +455,11 @@ static imgtoolerr_t vzdos_diskimage_nextenum(imgtool_directory *enumeration, img
|
||||
|
||||
/* TRK 0 sector 15 is used to hold the track map of the disk with one bit
|
||||
corresponding to a sector used. */
|
||||
static imgtoolerr_t vzdos_diskimage_freespace(imgtool_partition *partition, UINT64 *size)
|
||||
static imgtoolerr_t vzdos_diskimage_freespace(imgtool::partition *partition, UINT64 *size)
|
||||
{
|
||||
imgtoolerr_t ret;
|
||||
int i;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
UINT8 c, v, buffer[DATA_SIZE + 2];
|
||||
*size = 0;
|
||||
|
||||
@ -478,10 +478,10 @@ static imgtoolerr_t vzdos_diskimage_freespace(imgtool_partition *partition, UINT
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t vzdos_diskimage_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t vzdos_diskimage_readfile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
imgtoolerr_t ret;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
int filesize, track, sector;
|
||||
vzdos_dirent ent;
|
||||
UINT8 buffer[DATA_SIZE + 2];
|
||||
@ -524,10 +524,10 @@ static imgtoolerr_t vzdos_diskimage_readfile(imgtool_partition *partition, const
|
||||
}
|
||||
|
||||
/* deletes directory entry, clears trackmap entries and sectors */
|
||||
static imgtoolerr_t vzdos_diskimage_deletefile(imgtool_partition *partition, const char *fname)
|
||||
static imgtoolerr_t vzdos_diskimage_deletefile(imgtool::partition *partition, const char *fname)
|
||||
{
|
||||
imgtoolerr_t ret;
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
int index, filesize, track, sector, next_track, next_sector;
|
||||
vzdos_dirent entry, next_entry;
|
||||
UINT8 buffer[DATA_SIZE + 2];
|
||||
@ -602,10 +602,10 @@ static imgtoolerr_t vzdos_diskimage_deletefile(imgtool_partition *partition, con
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t vzdos_writefile(imgtool_partition *partition, int offset, imgtool_stream *sourcef, vzdos_dirent *entry)
|
||||
static imgtoolerr_t vzdos_writefile(imgtool::partition *partition, int offset, imgtool_stream *sourcef, vzdos_dirent *entry)
|
||||
{
|
||||
imgtoolerr_t ret;
|
||||
imgtool::image *img = imgtool_partition_image(partition);
|
||||
imgtool::image *img = &partition->image();
|
||||
int index, track, sector, toread, next_track, next_sector;
|
||||
vzdos_dirent temp_entry;
|
||||
UINT64 filesize = 0, freespace = 0;
|
||||
@ -700,7 +700,7 @@ static imgtoolerr_t vzdos_writefile(imgtool_partition *partition, int offset, im
|
||||
}
|
||||
|
||||
/* create a new file or overwrite a file */
|
||||
static imgtoolerr_t vzdos_diskimage_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
static imgtoolerr_t vzdos_diskimage_writefile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
imgtoolerr_t ret;
|
||||
int ftype;
|
||||
@ -741,10 +741,10 @@ static imgtoolerr_t vzdos_diskimage_writefile(imgtool_partition *partition, cons
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t vzdos_diskimage_suggesttransfer(imgtool_partition *partition, const char *fname, imgtool_transfer_suggestion *suggestions, size_t suggestions_length)
|
||||
static imgtoolerr_t vzdos_diskimage_suggesttransfer(imgtool::partition *partition, const char *fname, imgtool_transfer_suggestion *suggestions, size_t suggestions_length)
|
||||
{
|
||||
imgtoolerr_t ret;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
vzdos_dirent entry;
|
||||
|
||||
if (fname) {
|
||||
@ -808,10 +808,10 @@ static imgtoolerr_t vzdos_diskimage_create(imgtool::image *img, imgtool_stream *
|
||||
Imgtool vz filter code
|
||||
*********************************************************************/
|
||||
|
||||
static imgtoolerr_t vzsnapshot_readfile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
static imgtoolerr_t vzsnapshot_readfile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *destf)
|
||||
{
|
||||
imgtoolerr_t ret;
|
||||
imgtool::image *image = imgtool_partition_image(partition);
|
||||
imgtool::image *image = &partition->image();
|
||||
vzdos_dirent entry;
|
||||
UINT8 header[24];
|
||||
|
||||
@ -852,7 +852,7 @@ static imgtoolerr_t vzsnapshot_readfile(imgtool_partition *partition, const char
|
||||
return IMGTOOLERR_SUCCESS;
|
||||
}
|
||||
|
||||
static imgtoolerr_t vzsnapshot_writefile(imgtool_partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
static imgtoolerr_t vzsnapshot_writefile(imgtool::partition *partition, const char *filename, const char *fork, imgtool_stream *sourcef, util::option_resolution *opts)
|
||||
{
|
||||
imgtoolerr_t ret;
|
||||
int fnameopt;
|
||||
|
Loading…
Reference in New Issue
Block a user