Skip to content

Commit

Permalink
Merge pull request Kazade#1 from garrafonsoft/master
Browse files Browse the repository at this point in the history
Add macOS 10.11.x support
  • Loading branch information
Kazade authored Jun 15, 2017
2 parents 0e815bd + 0d15b91 commit 2fcb0b2
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion cdi4dc/inc/cdibuild.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
int write_gap_tracks(FILE* cdi);
int write_data_track(FILE* cdi, FILE* iso);
void write_cdi_header_start(FILE* cdi, char* cdiname);
void write_cdi_head_end(FILE* cdi, char* volumename, long total_cdi_space_used, long cdi_end_image_tracks);
void write_cdi_head_end(FILE* cdi, char* volumename, uint32_t total_cdi_space_used, long cdi_end_image_tracks);

#endif // __CDIBUILD__H__
2 changes: 1 addition & 1 deletion cdi4dc/inc/tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void fill_buffer(unsigned char *buf, int total_size, int values_array_size, cons
uint32_t fsize(FILE *stream);
void get_volumename(FILE* iso, char* volume_name);
int check_iso_is_bootable(FILE* iso);
int get_total_cdi_space_used(uint32_t data_sectors_count);
uint32_t get_total_cdi_space_used(uint32_t data_sectors_count);
int get_iso_msinfo_value(FILE* iso);
void write_null_block(FILE *cdi, int size);
void write_array_block(FILE* cdi, int array_size, const int array_entries, const unsigned int values_array[][2]);
Expand Down
12 changes: 6 additions & 6 deletions cdi4dc/src/cdiaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ int write_cdi_audio_track(FILE *cdi) {
// ecrire premier secteur audio
write_null_block(cdi, cdi_start_file_header);

// ecrire la piste audio elle même
// ecrire la piste audio elle m�me
write_null_block(cdi, cdi_audio_track_total_size);

return 0;
}

// ecrire le secteur 2 (données) du header CDI. il contient le nombre de secteurs de données
// ecrire le secteur 2 (donn�es) du header CDI. il contient le nombre de secteurs de donn�es
void write_cdi_head_data_sector(FILE* cdi, long data_sector_count) {
uint8_t *buf = (uint8_t*) malloc(sector2_size);
fill_buffer(buf, sector2_size, sector2_entries, sector2);
Expand All @@ -50,15 +50,15 @@ void write_cdi_head_data_sector(FILE* cdi, long data_sector_count) {
free(buf);
}

// ecrire l'header à la fin du fichier. Cette fonction appelle toutes les autres situées ci dessus !
void write_audio_cdi_header(FILE *cdi, char* cdiname, char* volume_name, long data_sector_count, long total_cdi_space_used) {
// ecrire l'header la fin du fichier. Cette fonction appelle toutes les autres situ�es ci dessus !
void write_audio_cdi_header(FILE *cdi, char* cdiname, char* volume_name, long data_sector_count, uint32_t total_cdi_space_used) {

struct cdi_header head;
uint32_t cdi_end_image_tracks;

cdi_end_image_tracks = ftell(cdi); // emplacement de l'header

// en tête
// en t�te
head.track_count = 0x02;
head.first_track_num = 0x01;
head.padding = 0x00000000;
Expand All @@ -67,7 +67,7 @@ void write_audio_cdi_header(FILE *cdi, char* cdiname, char* volume_name, long da
get_full_filename(cdiname, cdiname); // on remplace l'ancien nom relatif par le nom absolu
#endif

// ecrire le début de l'header
// ecrire le d�but de l'header
fwrite(&head, sizeof(head), 1, cdi);

// sector 1 (audio)
Expand Down
2 changes: 1 addition & 1 deletion cdi4dc/src/cdidata.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void write_cdi_header_data_data_sector_2(FILE* cdi, long data_sector_count) {
}

// ecrire l'header à la fin du fichier. Cette fonction appelle toutes les autres situées ci dessus !
int write_data_cdi_header(FILE *cdi, char* cdiname, char* volume_name, long data_sector_count, long total_cdi_space_used) {
int write_data_cdi_header(FILE *cdi, char* cdiname, char* volume_name, long data_sector_count, uint32_t total_cdi_space_used) {

struct cdi_header head;
uint32_t cdi_end_image_tracks;
Expand Down
6 changes: 3 additions & 3 deletions cdi4dc/src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,20 @@ void write_cdi_header_start(FILE* cdi, char* cdiname) {
}

// ecrire la fin de l'header CDI (contient le nom du volume, la taille totale des secteurs du CDI et une valeur servant à calculer l'emplacement de l'header du CDI).
void write_cdi_head_end(FILE* cdi, char* volumename, long total_cdi_space_used, long cdi_end_image_tracks) {
void write_cdi_head_end(FILE* cdi, char* volumename, uint32_t total_cdi_space_used, long cdi_end_image_tracks) {

int i;
uint8_t volumename_length;
uint32_t cdi_header_pos;

volumename_length = strlen(volumename);

// ecrire la taille utilisée au total sur le disque
fwrite(&total_cdi_space_used, sizeof(total_cdi_space_used), 1, cdi);

// ecrire la taille du volume
fwrite(&volumename_length, sizeof(volumename_length), 1, cdi);

// ecrire le nom du volume
fwrite(volumename, volumename_length, 1, cdi);

Expand Down
4 changes: 2 additions & 2 deletions cdi4dc/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
uint32_t x, y; // position ou on doit placer le curseur avant d'écrire le pourcentage

int write_cdi_audio_track(FILE *cdi);
void write_audio_cdi_header(FILE *cdi, char* cdiname, char* volume_name, long data_sector_count, long total_cdi_space_used);
int write_data_cdi_header(FILE *cdi, char* cdiname, char* volume_name, long data_sector_count, long total_cdi_space_used);
void write_audio_cdi_header(FILE *cdi, char* cdiname, char* volume_name, long data_sector_count, uint32_t total_cdi_space_used);
int write_data_cdi_header(FILE *cdi, char* cdiname, char* volume_name, long data_sector_count, uint32_t total_cdi_space_used);
void write_data_gap_start_track(FILE* cdi);
void write_data_header_boot_track(FILE* cdi, FILE* iso);

Expand Down
4 changes: 2 additions & 2 deletions cdi4dc/src/tools.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ void get_volumename(FILE* iso, char* volume_name) {
// result[i] = '\0';

fseek (iso, curpos, SEEK_SET); // restituer la position

memcpy(volume_name, result, strlen(result) + 1); // + 1 pour le \0 !
}

// donne la taille utilisée par le CDI en fonction des secteurs de données.
int get_total_cdi_space_used(uint32_t data_sectors_count) {
uint32_t get_total_cdi_space_used(uint32_t data_sectors_count) {
/* 301 : nombre de secteurs audio
11702 : msinfo
150 : j'en sais rien, c'est comme ça */
Expand Down
4 changes: 4 additions & 0 deletions common/src/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
#ifndef WIN32
#include <libgen.h>
#include <stdlib.h>
#ifdef __APPLE__
#include <limits.h>
#else
#include <linux/limits.h>
#endif
#define _MAX_FNAME 4096
#endif

Expand Down

0 comments on commit 2fcb0b2

Please sign in to comment.