You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(35) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(37) |
Feb
(10) |
Mar
|
Apr
(2) |
May
(17) |
Jun
(1) |
Jul
(14) |
Aug
(14) |
Sep
(4) |
Oct
|
Nov
(14) |
Dec
(4) |
2005 |
Jan
(6) |
Feb
|
Mar
|
Apr
(6) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
(92) |
Dec
(12) |
2006 |
Jan
(3) |
Feb
(4) |
Mar
|
Apr
(5) |
May
(3) |
Jun
(15) |
Jul
(3) |
Aug
(1) |
Sep
(29) |
Oct
(1) |
Nov
(6) |
Dec
(5) |
2007 |
Jan
(2) |
Feb
(2) |
Mar
|
Apr
(3) |
May
(14) |
Jun
(2) |
Jul
(16) |
Aug
(73) |
Sep
(12) |
Oct
(9) |
Nov
(27) |
Dec
(3) |
2008 |
Jan
(4) |
Feb
(4) |
Mar
(3) |
Apr
(8) |
May
(23) |
Jun
(4) |
Jul
(1) |
Aug
(3) |
Sep
(7) |
Oct
(5) |
Nov
(1) |
Dec
(1) |
2009 |
Jan
|
Feb
(10) |
Mar
|
Apr
(4) |
May
(4) |
Jun
(10) |
Jul
|
Aug
(1) |
Sep
|
Oct
(7) |
Nov
|
Dec
(1) |
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
(6) |
May
|
Jun
(3) |
Jul
(11) |
Aug
(1) |
Sep
|
Oct
(15) |
Nov
(1) |
Dec
(5) |
2011 |
Jan
(4) |
Feb
(1) |
Mar
(6) |
Apr
|
May
(22) |
Jun
|
Jul
(8) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2012 |
Jan
|
Feb
(10) |
Mar
(1) |
Apr
(6) |
May
(27) |
Jun
(48) |
Jul
(30) |
Aug
(4) |
Sep
|
Oct
(3) |
Nov
(1) |
Dec
(11) |
2013 |
Jan
(4) |
Feb
(7) |
Mar
(6) |
Apr
(18) |
May
(28) |
Jun
(20) |
Jul
|
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
(2) |
Dec
(7) |
2014 |
Jan
(3) |
Feb
(2) |
Mar
(4) |
Apr
(9) |
May
(11) |
Jun
(10) |
Jul
|
Aug
(18) |
Sep
(12) |
Oct
(17) |
Nov
(10) |
Dec
(16) |
2015 |
Jan
(5) |
Feb
(1) |
Mar
(5) |
Apr
(4) |
May
(28) |
Jun
(2) |
Jul
|
Aug
|
Sep
(6) |
Oct
|
Nov
(2) |
Dec
(1) |
2016 |
Jan
(14) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
(3) |
Jul
(4) |
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
(1) |
2017 |
Jan
(11) |
Feb
|
Mar
(21) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
(4) |
Oct
(4) |
Nov
|
Dec
(1) |
2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(13) |
Sep
(4) |
Oct
|
Nov
|
Dec
|
2020 |
Jan
(10) |
Feb
(9) |
Mar
(5) |
Apr
(4) |
May
(3) |
Jun
(18) |
Jul
(4) |
Aug
(2) |
Sep
(20) |
Oct
(2) |
Nov
|
Dec
|
2021 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(1) |
Jun
(2) |
Jul
(1) |
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
(2) |
2022 |
Jan
(1) |
Feb
(2) |
Mar
(2) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(5) |
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
2023 |
Jan
(10) |
Feb
(7) |
Mar
(29) |
Apr
(31) |
May
(29) |
Jun
(34) |
Jul
(3) |
Aug
(24) |
Sep
(22) |
Oct
(10) |
Nov
(38) |
Dec
(27) |
2024 |
Jan
(15) |
Feb
(8) |
Mar
(4) |
Apr
(20) |
May
(33) |
Jun
(18) |
Jul
(15) |
Aug
(23) |
Sep
(26) |
Oct
(32) |
Nov
(6) |
Dec
(4) |
2025 |
Jan
(7) |
Feb
(1) |
Mar
(1) |
Apr
(4) |
May
(46) |
Jun
(19) |
Jul
(26) |
Aug
(13) |
Sep
|
Oct
|
Nov
|
Dec
|
From: bogglez <bo...@us...> - 2017-03-10 00:50:59
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via e7f452c1498a2453d6ed0a07e1dff988ed4b2fe0 (commit) via c191a270a110e13dc24e9a1fbeabd82decadd5bd (commit) from eef2003a70eb19ef7afcdc940bbdb0aaed84c406 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e7f452c1498a2453d6ed0a07e1dff988ed4b2fe0 Author: bogglez <bo...@pr...> Date: Fri Mar 10 01:50:37 2017 +0100 isotest: add man page commit c191a270a110e13dc24e9a1fbeabd82decadd5bd Author: bogglez <bo...@pr...> Date: Fri Mar 10 01:50:27 2017 +0100 rdtest: remove empty EXAMPLES from man page ----------------------------------------------------------------------- Summary of changes: utils/isotest/isotest.1 | 19 +++++++++++++++++++ utils/rdtest/rdtest.1 | 1 - 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 utils/isotest/isotest.1 diff --git a/utils/isotest/isotest.1 b/utils/isotest/isotest.1 new file mode 100644 index 0000000..43803e9 --- /dev/null +++ b/utils/isotest/isotest.1 @@ -0,0 +1,19 @@ +.TH ISOTEST 1 "Mar 2017" "Version 1.0" +.SH NAME +isotest \- Test ISO filesystem reader +.SH SYNOPSIS +.B isotest + +.SH DESCRIPTION +.B isotest +is used to test the ISO filesystem reader. +It is a functional duplicate of fs_iso9660, but designed to run on a PC for +testing. +In Linux, accessing the /dev device on a single-session CD puts the +"bootstrap" zone at offset 0x8000, and the begin of the CD data itself at + +.SH AUTHOR +This manual page was initially written by Stefan Galowicz <bo...@pr...>, +for the KOS project. +.TP +The program has been initially written by Dan Potter in 2000. diff --git a/utils/rdtest/rdtest.1 b/utils/rdtest/rdtest.1 index 6c4528e..5c071cc 100644 --- a/utils/rdtest/rdtest.1 +++ b/utils/rdtest/rdtest.1 @@ -11,7 +11,6 @@ It is a functional duplicate of fs_romdisk, but designed to run on a PC for testing. Loads to VMA 0x8c010000. This is an exact functional duplicate of the routine in process/elf.c and is used for testing new changes first. -.SH EXAMPLES .SH AUTHOR This manual page was initially written by Stefan Galowicz <bo...@pr...>, hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: bogglez <bo...@us...> - 2017-03-10 00:48:27
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via eef2003a70eb19ef7afcdc940bbdb0aaed84c406 (commit) from 746d6eaeca22b8f4fb45adcc91868e4cb990a959 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit eef2003a70eb19ef7afcdc940bbdb0aaed84c406 Author: bogglez <bo...@pr...> Date: Fri Mar 10 01:48:08 2017 +0100 isotest: fixed some warnings ----------------------------------------------------------------------- Summary of changes: utils/isotest/isotest.c | 112 +++++++++++++++++++++++++----------------------- 1 file changed, 59 insertions(+), 53 deletions(-) diff --git a/utils/isotest/isotest.c b/utils/isotest/isotest.c index ce972f0..16963ac 100644 --- a/utils/isotest/isotest.c +++ b/utils/isotest/isotest.c @@ -20,6 +20,7 @@ In Linux, accessing the /dev device on a single-session CD puts the /****************************** LINUX SPECIFIC CODE ***********************************/ #include <stdio.h> +#include <ctype.h> typedef unsigned char uint8; typedef unsigned short uint16; @@ -29,7 +30,7 @@ typedef signed short int16; typedef signed long int32; /* Low-level sector read (for Linux to emulate hardware/cd.c) */ -static int cdrom_read_sectors(char *buffer, uint32 sector, uint32 cnt) { +static int cdrom_read_sectors(void *buffer, uint32 sector, uint32 cnt) { FILE *f; /* Subtract out DC's LBA offset */ @@ -40,7 +41,10 @@ static int cdrom_read_sectors(char *buffer, uint32 sector, uint32 cnt) { if(!f) return -1; fseek(f, sector * 2048, SEEK_SET); - fread(buffer, cnt * 2048, 1, f); + if(fread(buffer, cnt * 2048, 1, f) != 1) { + fclose(f); + return 1; + } fclose(f); return 0; @@ -49,13 +53,15 @@ static int cdrom_read_sectors(char *buffer, uint32 sector, uint32 cnt) { /* Linux emulation of various other KOS CD prims */ typedef int CDROM_TOC; -int cdrom_reinit() { +static int cdrom_reinit() { return 0; } -int cdrom_read_toc(CDROM_TOC *toc, int session) { + +static int cdrom_read_toc(CDROM_TOC *toc, int session) { return 0; } -uint32 cdrom_locate_data_track(CDROM_TOC *toc) { + +static uint32 cdrom_locate_data_track(CDROM_TOC *toc) { return 150; } @@ -72,18 +78,21 @@ typedef struct { } dirent_t; typedef void *vfs_handler[]; -int fs_handler_add(char *fn, void *p) { + +static int fs_handler_add(char *fn, void *p) { return 0; } -int fs_handler_remove(void *p) { + +static int fs_handler_remove(void *p) { return 0; } /* Thread prims */ typedef int thd_mutex_t; -void thd_mutex_reset(int *p) { } -void thd_mutex_lock(int *p) { } -void thd_mutex_unlock(int *p) { } + +static void thd_mutex_reset(int *p) { } +static void thd_mutex_lock(int *p) { } +static void thd_mutex_unlock(int *p) { } /* iso9660 defines */ #define MAX_ISO_FILES 8 @@ -115,11 +124,13 @@ typedef struct { char name[1]; } iso_dirent_t; +#if 0 /* Util function to reverse the byte order of a uint32 */ static uint32 ntohl_32(void *data) { uint8 *d = (uint8*)data; return (d[0] << 24) | (d[1] << 16) | (d[2] << 8) | (d[3] << 0); } +#endif /* This seems kinda silly, but it's important since it allows us to do unaligned accesses on a buffer */ @@ -128,10 +139,12 @@ static uint32 htohl_32(void *data) { return (d[0] << 0) | (d[1] << 8) | (d[2] << 16) | (d[3] << 24); } +#if 0 /* Read red-book section 7.1.1 number (8 bit) */ static uint8 iso_711(uint8 *from) { return (*from & 0xff); } +#endif /* Read red-book section 7.3.3 number (32 bit LE / 32 bit BE) */ static uint32 iso_733(uint8 *from) { @@ -193,7 +206,7 @@ static void bgrad(int block) { /* Pulls the requested sector into a cache block and returns the cache block index. Note that the sector in question may already be in the cache, in which case it just returns the containing block. */ -static int bread(uint32 sector) { +static int bread(int32 sector) { int i, rv = -1; thd_mutex_lock(&cache_mutex); @@ -240,10 +253,10 @@ bread_exit: /* Higher-level ISO9660 primitives */ /* Root FS session location (in sectors) */ -static uint32 session_base = 0; +static int32 session_base = 0; /* Root directory extent and size in bytes */ -static uint32 root_extent = 0, root_size = 0; +static int32 root_extent = 0, root_size = 0; /* Root dirent */ static iso_dirent_t root_dirent; @@ -313,10 +326,9 @@ static int fncompare(const char *isofn, int isosize, const char *normalfn) { expect this buffer to stay around much longer than the call itself). */ static iso_dirent_t *find_object(const char *fn, int dir, - uint32 dir_extent, uint32 dir_size) { - int i; - char *p1; - iso_dirent_t *de; + int32 dir_extent, int32 dir_size) { + int32 i; + iso_dirent_t * de; while(dir_size > 0) { int c = bread(dir_extent); @@ -393,10 +405,10 @@ static iso_dirent_t *find_object_path(const char *fn, int dir, iso_dirent_t *sta /* File handles.. I could probably do this with a linked list, but I'm just too lazy right now. =) */ static struct { - uint32 first_extent; /* First sector */ + int32 first_extent; /* First sector */ int dir; /* >0 if a directory */ - uint32 ptr; /* Current read position in bytes */ - uint32 size; /* Length of file in bytes */ + int32 ptr; /* Current read position in bytes */ + int32 size; /* Length of file in bytes */ dirent_t dirent; /* A static dirent to pass back to clients */ } fh[MAX_ISO_FILES]; @@ -404,8 +416,8 @@ static struct { static thd_mutex_t fh_mutex; /* Open a file or directory */ -uint32 iso_open(const char *fn, int mode) { - uint32 fd; +static int32 iso_open(const char *fn, int mode) { + int32 fd; iso_dirent_t *de; /* Make sure they don't want to open things as writeable */ @@ -446,7 +458,7 @@ uint32 iso_open(const char *fn, int mode) { } /* Close a file or directory */ -void iso_close(uint32 fd) { +static void iso_close(uint32 fd) { /* Check that the fd is valid */ if(fd < MAX_ISO_FILES) { /* No need to lock the mutex: this is an atomic op */ @@ -455,8 +467,9 @@ void iso_close(uint32 fd) { } /* Read from a file */ -ssize_t iso_read(uint32 fd, void *buf, size_t bytes) { - int rv = 0, toread, thissect, c; +static ssize_t iso_read(uint32 fd, char *buf, size_t bytes) { + int rv = 0, c; + size_t toread, thissect; /* Check that the fd is valid */ if(fd >= MAX_ISO_FILES || fh[fd].first_extent == 0) @@ -465,8 +478,8 @@ ssize_t iso_read(uint32 fd, void *buf, size_t bytes) { /* Read zero or more sectors into the buffer from the current pos */ while(bytes > 0) { /* Figure out how much we still need to read */ - toread = (bytes > (fh[fd].size - fh[fd].ptr)) ? - fh[fd].size - fh[fd].ptr : bytes; + toread = (bytes > (size_t)(fh[fd].size - fh[fd].ptr)) ? + (size_t)(fh[fd].size - fh[fd].ptr) : bytes; if(toread == 0) break; @@ -492,7 +505,7 @@ ssize_t iso_read(uint32 fd, void *buf, size_t bytes) { } /* Seek elsewhere in a file */ -off_t iso_seek(uint32 fd, off_t offset, int whence) { +static off_t iso_seek(uint32 fd, off_t offset, int whence) { /* Check that the fd is valid */ if(fd >= MAX_ISO_FILES || fh[fd].first_extent == 0) return -1; @@ -510,15 +523,13 @@ off_t iso_seek(uint32 fd, off_t offset, int whence) { } /* Check bounds */ - if(fh[fd].ptr < 0) fh[fd].ptr = 0; - if(fh[fd].ptr > fh[fd].size) fh[fd].ptr = fh[fd].size; return fh[fd].ptr; } /* Tell where in the file we are */ -off_t iso_tell(uint32 fd) { +static off_t iso_tell(uint32 fd) { if(fd >= MAX_ISO_FILES || fh[fd].first_extent == 0) return -1; @@ -526,7 +537,7 @@ off_t iso_tell(uint32 fd) { } /* Tell how big the file is */ -size_t iso_total(uint32 fd) { +static size_t iso_total(uint32 fd) { if(fd >= MAX_ISO_FILES || fh[fd].first_extent == 0) return -1; @@ -545,8 +556,8 @@ static void fn_postprocess(char *fn) { } /* Read a directory entry */ -dirent_t *iso_readdir(uint32 fd) { - int i, c; +static dirent_t *iso_readdir(uint32 fd) { + int c; iso_dirent_t *de; if(fd >= MAX_ISO_FILES || fh[fd].first_extent == 0 || !fh[fd].dir) @@ -611,7 +622,7 @@ static vfs_handler vh = { }; /* Initialize the file system */ -int fs_iso9660_init() { +static int fs_iso9660_init() { int i; /* Reset fd's */ @@ -635,7 +646,7 @@ int fs_iso9660_init() { } /* De-init the file system */ -int fs_iso9660_shutdown() { +static int fs_iso9660_shutdown() { int i; /* Dealloc cache block space */ @@ -651,7 +662,8 @@ int fs_iso9660_shutdown() { /********************************************************************************/ -void read_dir(uint32 extent, uint32 size) { +#if 0 +static void read_dir(uint32 extent, uint32 size) { int i; iso_dirent_t *de; char fn[32]; @@ -681,9 +693,10 @@ void read_dir(uint32 extent, uint32 size) { size -= 2048; } } +#endif -void main() { +int main() { fs_iso9660_init(); /* @@ -695,7 +708,7 @@ void main() { fd = iso_open("/escape.txt", O_RDONLY); if (fd == 0) { printf("Couldn't open file\n"); - return; + return 1; } size = iso_total(fd); printf("fd is %d, size is %08lx\n", fd, size); @@ -705,7 +718,7 @@ void main() { r = iso_read(fd, buf, 666); if (r < 0) { printf("Read error\n"); - return; + return 1; } buf[r] = 0; printf("%s", buf); @@ -718,7 +731,7 @@ void main() { iso_close(fd); */ { - uint32 fd, t; + uint32 fd; dirent_t *de; printf("Opening /demos"); @@ -726,7 +739,7 @@ void main() { if(fd == 0) { printf("Couldn't open file\n"); - return; + return 1; } printf("Scanning dir:\n"); @@ -735,21 +748,14 @@ void main() { printf("%s\t%d\n", de->name, de->size); if(!strcmp(de->name, "R_WAR.ZIP")) { - t = 0; + // what's this test for? } } iso_close(fd); } -} - - - - - - - - - + fs_iso9660_shutdown(); + return 0; +} hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: bogglez <bo...@us...> - 2017-03-10 00:33:25
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 746d6eaeca22b8f4fb45adcc91868e4cb990a959 (commit) via 2a1cab8f9b8d5628f160701b7438d0d09f5d3667 (commit) from 352798c70276d33d9d28c039af603c9abe06558e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 746d6eaeca22b8f4fb45adcc91868e4cb990a959 Author: bogglez <bo...@pr...> Date: Fri Mar 10 01:33:04 2017 +0100 rdtest: add man page commit 2a1cab8f9b8d5628f160701b7438d0d09f5d3667 Author: bogglez <bo...@pr...> Date: Fri Mar 10 01:32:56 2017 +0100 rdtest: fix warnings Needs romdisk2.img, seems to be missing ----------------------------------------------------------------------- Summary of changes: utils/{bincnv/bincnv.8 => rdtest/rdtest.1} | 24 ++---- utils/rdtest/rdtest.c | 119 +++++++++++++++++++---------- 2 files changed, 86 insertions(+), 57 deletions(-) copy utils/{bincnv/bincnv.8 => rdtest/rdtest.1} (51%) diff --git a/utils/bincnv/bincnv.8 b/utils/rdtest/rdtest.1 similarity index 51% copy from utils/bincnv/bincnv.8 copy to utils/rdtest/rdtest.1 index bbfcad1..6c4528e 100644 --- a/utils/bincnv/bincnv.8 +++ b/utils/rdtest/rdtest.1 @@ -1,28 +1,20 @@ -.TH BINCNV 8 "Mar 2017" "Version 1.0" +.TH RDTEST 1 "Mar 2017" "Version 1.0" .SH NAME -bincnv \- Test ELF to BIN converter +rdtest \- Test romdisk filesystem reader .SH SYNOPSIS -.B bincnv -[ -.B \-d -] -.IR from -.IR to +.B rdtest .SH DESCRIPTION -.B bincnv -is used to test the ELF to BIN converter. +.B rdtest +is used to test the romdisk filesystem reader. +It is a functional duplicate of fs_romdisk, but designed to run on a PC for +testing. Loads to VMA 0x8c010000. This is an exact functional duplicate of the routine in process/elf.c and is used for testing new changes first. .SH EXAMPLES -.EX -.B - bincnv from.elf to.bin -.EE - .SH AUTHOR This manual page was initially written by Stefan Galowicz <bo...@pr...>, for the KOS project. .TP -The program has been initially written by Dan Potter in 2000. +The program has been initially written by Dan Potter in 2001. diff --git a/utils/rdtest/rdtest.c b/utils/rdtest/rdtest.c index d19afcb..549ac97 100644 --- a/utils/rdtest/rdtest.c +++ b/utils/rdtest/rdtest.c @@ -32,18 +32,18 @@ typedef struct { } dirent_t; typedef void *vfs_handler[]; -int fs_handler_add(char *fn, void *p) { +static int fs_handler_add(char *fn, void *p) { return 0; } -int fs_handler_remove(void *p) { +static int fs_handler_remove(void *p) { return 0; } /* Thread prims */ typedef int thd_mutex_t; -void thd_mutex_reset(int *p) { } -void thd_mutex_lock(int *p) { } -void thd_mutex_unlock(int *p) { } +static void thd_mutex_reset(int *p) { } +static void thd_mutex_lock(int *p) { } +static void thd_mutex_unlock(int *p) { } /* romdisk defines */ #define MAX_RD_FILES 8 @@ -242,7 +242,7 @@ static uint32 romdisk_find(const char *fn) { #endif /* Open a file or directory */ -uint32 romdisk_open(const char *fn, int mode) { +static uint32 romdisk_open(const char *fn, int mode) { uint32 fd; uint32 filehdr; romdisk_file_t *fhdr; @@ -286,7 +286,7 @@ uint32 romdisk_open(const char *fn, int mode) { } /* Close a file or directory */ -void romdisk_close(uint32 fd) { +static void romdisk_close(uint32 fd) { /* Check that the fd is valid */ if(fd < MAX_RD_FILES) { /* No need to lock the mutex: this is an atomic op */ @@ -295,9 +295,7 @@ void romdisk_close(uint32 fd) { } /* Read from a file */ -ssize_t romdisk_read(uint32 fd, void *buf, size_t bytes) { - int rv = 0, toread, thissect, c; - +static ssize_t romdisk_read(uint32 fd, void *buf, size_t bytes) { /* Check that the fd is valid */ if(fd >= MAX_RD_FILES || fh[fd].index == 0) return -1; @@ -314,7 +312,7 @@ ssize_t romdisk_read(uint32 fd, void *buf, size_t bytes) { } /* Seek elsewhere in a file */ -off_t romdisk_seek(uint32 fd, off_t offset, int whence) { +static off_t romdisk_seek(uint32 fd, off_t offset, int whence) { /* Check that the fd is valid */ if(fd >= MAX_RD_FILES || fh[fd].index == 0) return -1; @@ -332,15 +330,13 @@ off_t romdisk_seek(uint32 fd, off_t offset, int whence) { } /* Check bounds */ - if(fh[fd].ptr < 0) fh[fd].ptr = 0; - if(fh[fd].ptr > fh[fd].size) fh[fd].ptr = fh[fd].size; return fh[fd].ptr; } /* Tell where in the file we are */ -off_t romdisk_tell(uint32 fd) { +static off_t romdisk_tell(uint32 fd) { if(fd >= MAX_RD_FILES || fh[fd].index == 0) return -1; @@ -348,7 +344,7 @@ off_t romdisk_tell(uint32 fd) { } /* Tell how big the file is */ -size_t romdisk_total(uint32 fd) { +static size_t romdisk_total(uint32 fd) { if(fd >= MAX_RD_FILES || fh[fd].index == 0) return -1; @@ -382,7 +378,7 @@ static vfs_handler vh = { }; /* Initialize the file system */ -int fs_romdisk_init(uint8 *img) { +static int fs_romdisk_init(uint8 *img) { int i, ni; romdisk_file_t *fhdr; @@ -392,21 +388,21 @@ int fs_romdisk_init(uint8 *img) { /* Check and print some info about it */ romdisk_hdr = (romdisk_hdr_t *)romdisk_image; - if(strncmp(romdisk_image, "-rom1fs-", 8)) { - printf("Rom disk image at 0x%x is not a ROMFS image\r\n", img); + if(strncmp((char*)romdisk_image, "-rom1fs-", 8)) { + printf("Rom disk image at 0x%p is not a ROMFS image\r\n", img); return -1; } - printf("ROMFS image recognized. Full size is 0x%x bytes\r\n", + printf("ROMFS image recognized. Full size is 0x%lx bytes\r\n", ntohl_32(&romdisk_hdr->full_size)); - printf(" Checksum is 0x%x\r\n", + printf(" Checksum is 0x%lx\r\n", ntohl_32(&romdisk_hdr->checksum)); printf(" Volume ID is ``%s''\r\n", romdisk_hdr->volume_name); romdisk_files = sizeof(romdisk_hdr_t) + (strlen(romdisk_hdr->volume_name) / 16) * 16; - printf(" File entries begin at offset 0x%x\r\n", + printf(" File entries begin at offset 0x%lx\r\n", romdisk_files); printf("Files:\r\n"); @@ -420,11 +416,11 @@ int fs_romdisk_init(uint8 *img) { printf("next=%x, ", ni & 0xfffffff0); printf("type=%x, ", ni & 0x0f); ni &= 0xfffffff0; - printf("spec_info=%x, ", ntohl_32(&fhdr->spec_info)); - printf("size=%x, ", ntohl_32(&fhdr->size)); - printf("checksum=%x ", ntohl_32(&fhdr->checksum)); + printf("spec_info=%lx, ", ntohl_32(&fhdr->spec_info)); + printf("size=%lx, ", ntohl_32(&fhdr->size)); + printf("checksum=%lx ", ntohl_32(&fhdr->checksum)); printf("filename='%s'\r\n", fhdr->filename); - printf(" File data starts at %x\r\n", + printf(" File data starts at %lx\r\n", i + sizeof(romdisk_file_t) + (strlen(fhdr->filename) / 16) * 16); @@ -446,7 +442,7 @@ int fs_romdisk_init(uint8 *img) { } /* De-init the file system */ -int fs_romdisk_shutdown() { +static int fs_romdisk_shutdown() { return fs_handler_remove(&vh); } @@ -456,27 +452,68 @@ int fs_romdisk_shutdown() { /********************************************************************************/ -void init() { - char *img; - FILE *f; - int size; +/** + * Helper function to load the raw texture data into an array. + * @param filename The filename of the texture. + * @param data A pointer to an array where the data should be stored. + * @param size A pointer to a variable where to size should be stored. + * @return 0 on success, non-zero on error. + */ +static int read_file_contents(char const * const filename, char **data, size_t *size) { + FILE *f = 0; + + f = fopen(filename, "rb"); + + // Read texture from file + if(!f) { + return 1; + } + + fseek(f, 0, SEEK_END); + long imageSize = ftell(f); + rewind(f); - f = fopen("romdisk2.img", "rb"); + *data = malloc(imageSize); + if(!*data) { + fclose(f); + return 2; + } - if(!f) return; + if(fread(*data, imageSize, 1, f) != 1) { + free(*data); + fclose(f); + return 3; + } - fseek(f, 0, SEEK_END); - size = ftell(f); - fseek(f, 0, SEEK_SET); - img = malloc(size); - fread(img, size, 1, f); fclose(f); + *size = imageSize; + + return 0; +} + +static int init() { + uint8 *img; + size_t size; + + if(read_file_contents("romdisk2.img", (char**)&img, &size)) { + fprintf(stderr, "Cannot read romdisk2.img.\n"); + return 1; + } + fs_romdisk_init(img); + fs_romdisk_shutdown(); + + free(img); + + return 0; } int main() { - init(); + if(init()) { + fprintf(stderr, "Cannot init.\n"); + return 1; + } { uint32 fd, size; @@ -487,11 +524,11 @@ int main() { if(fd == 0) { printf("Couldn't open file\n"); - return; + return 1; } size = romdisk_total(fd); - printf("fd is %d, size is %08lx\n", fd, size); + printf("fd is %ld, size is %08lx\n", fd, size); while(size > 0) { int r; @@ -499,7 +536,7 @@ int main() { if(r < 0) { printf("Read error\n"); - return; + return 1; } buf[r] = 0; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: bogglez <bo...@us...> - 2017-03-10 00:09:41
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 352798c70276d33d9d28c039af603c9abe06558e (commit) via b852265cea134ef1a7659b3b31d84ea5c009994f (commit) from c627b1798d8c845cd78a64314451a4daaa2c55dd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 352798c70276d33d9d28c039af603c9abe06558e Author: bogglez <bo...@pr...> Date: Fri Mar 10 01:09:20 2017 +0100 gentexfont: add man page commit b852265cea134ef1a7659b3b31d84ea5c009994f Author: bogglez <bo...@pr...> Date: Fri Mar 10 01:00:15 2017 +0100 gentexfont: minor fixes ----------------------------------------------------------------------- Summary of changes: utils/gentexfont/gentexfont.1 | 67 +++++++++++++++++++++++++++++++++++++++++++ utils/gentexfont/gentexfont.c | 48 +++++++++++++++---------------- 2 files changed, 90 insertions(+), 25 deletions(-) create mode 100644 utils/gentexfont/gentexfont.1 diff --git a/utils/gentexfont/gentexfont.1 b/utils/gentexfont/gentexfont.1 new file mode 100644 index 0000000..f5f9efa --- /dev/null +++ b/utils/gentexfont/gentexfont.1 @@ -0,0 +1,67 @@ +.TH GENTEXFONT 1 "Mar 2017" "Version 1.0" +.SH NAME +gentexfont \- Create TXF font from X11 fonts +.SH SYNOPSIS +\fBgentexfont\fR [\fIOPTION\fR]... [\fIFILE\fR]... +[ +.B \-d +] +.IR from +.IR to + +.SH DESCRIPTION +.B gentexfont +is used to create TXF font files from X11 fonts. +Dan Potter downloaded this from a web article which discusses TXF fonts. + +.SH OPTIONS +.TP +.BR \-w +Specify texture width. Defaults to 256. + +.TP +.BR \-h " +Specify texture height. Defaults to 256. + +.TP +.BR \-gap +Specify gap between glyphs. Defaults to 1. + +.TP +.BR \-byte +Use a byte encoding (less compact) + +.TP +.BR \-bitmap +Use a bitmap encoding (default). + +.TP +.BR \-glist +Specify glyph list, e.g. "abcdef" + +.TP +.BR \-fn +Specify X11 font name. Defaults to Adobe Courier. + +.TP +.BR \-file +Specify output file name. Defaults to default.txf. + +.SH EXAMPLES + +.EX +.B + gentexfont executable.elf executable_gentexfontd.elf +.EE + +.EX +.B + gentexfont -d executable_gentexfontd.elf executable.elf +.EE + +.SH AUTHOR +This manual page was initially written by Stefan Galowicz <bo...@pr...>, +for the KOS project. +.TP +The program has been initially written by Marcus Comstedt and was obtained from +his site (http://mc.pp.se/dc/). diff --git a/utils/gentexfont/gentexfont.c b/utils/gentexfont/gentexfont.c index be27dc9..514f3cf 100644 --- a/utils/gentexfont/gentexfont.c +++ b/utils/gentexfont/gentexfont.c @@ -10,6 +10,7 @@ #include <assert.h> #include <stdlib.h> #include <stdio.h> +#include <string.h> #include <unistd.h> #include <X11/Xlib.h> #include <X11/Xutil.h> @@ -51,8 +52,7 @@ int gap = 1; #define MAX_GLYPHS_PER_GRAB 512 /* this is big enough for 2^9 glyph character sets */ -FontInfoPtr -SuckGlyphsFromServer(Display * dpy, Font font) { +static FontInfoPtr SuckGlyphsFromServer(Display * dpy, Font font) { Pixmap offscreen; XFontStruct *fontinfo; XImage *image; @@ -61,12 +61,14 @@ SuckGlyphsFromServer(Display * dpy, Font font) { int numchars; int width, height, pixwidth; int i, j; - XCharStruct *charinfo; + XCharStruct *charinfo = 0; XChar2b character; unsigned char *bitmapData; int x, y; - int spanLength; - int charWidth, charHeight, maxSpanLength; + int spanLength = 0; + int charWidth = 0; + int charHeight = 0; + int maxSpanLength; int grabList[MAX_GLYPHS_PER_GRAB]; int glyphsPerGrab = MAX_GLYPHS_PER_GRAB; int numToGrab, thisglyph; @@ -245,8 +247,9 @@ FreeFontAndReturn: return NULL; } -void -printGlyph(FontInfoPtr font, int c) { + +#if 0 +static void printGlyph(FontInfoPtr font, int c) { PerGlyphInfoPtr glyph; unsigned char *bitmapData; int width, height, spanLength; @@ -279,9 +282,9 @@ printGlyph(FontInfoPtr font, int c) { } } } +#endif -void -getMetric(FontInfoPtr font, int c, TexGlyphInfo * tgi) { +static void getMetric(FontInfoPtr font, int c, TexGlyphInfo * tgi) { PerGlyphInfoPtr glyph; unsigned char *bitmapData; @@ -317,8 +320,7 @@ getMetric(FontInfoPtr font, int c, TexGlyphInfo * tgi) { tgi->advance = glyph->advance; } -int -glyphCompare(const void *a, const void *b) { +static int glyphCompare(const void *a, const void *b) { unsigned char *c1 = (unsigned char *) a; unsigned char *c2 = (unsigned char *) b; TexGlyphInfo tgi1; @@ -329,13 +331,11 @@ glyphCompare(const void *a, const void *b) { return tgi2.height - tgi1.height; } -int -getFontel(unsigned char *bitmapData, int spanLength, int i, int j) { +static int getFontel(unsigned char *bitmapData, int spanLength, int i, int j) { return bitmapData[i * spanLength + j / 8] & (1 << (j & 7)) ? 255 : 0; } -void -placeGlyph(FontInfoPtr font, int c, unsigned char *texarea, int stride, int x, int y) { +static void placeGlyph(FontInfoPtr font, int c, unsigned char *texarea, int stride, int x, int y) { PerGlyphInfoPtr glyph; unsigned char *bitmapData; int width, height, spanLength; @@ -363,8 +363,7 @@ placeGlyph(FontInfoPtr font, int c, unsigned char *texarea, int stride, int x, i } } -char * -nodupstring(char *s) { +static char * nodupstring(char *s) { int len, i, p; char *new; @@ -383,13 +382,12 @@ nodupstring(char *s) { return new; } -void -main(int argc, char *argv[]) { +int main(int argc, char *argv[]) { int texw, texh; unsigned char *texarea, *texbitmap; FILE *file; int len, stride; - unsigned char *glist; + char *glist; int width, height; int px, py, maxheight; TexGlyphInfo tgi; @@ -426,7 +424,7 @@ main(int argc, char *argv[]) { } else if(!strcmp(argv[i], "-glist")) { i++; - glist = (unsigned char *) argv[i]; + glist = argv[i]; } else if(!strcmp(argv[i], "-fn")) { i++; @@ -447,8 +445,8 @@ main(int argc, char *argv[]) { printf(" -w # textureWidth (def=%d)\n", texw); printf(" -h # textureHeight (def=%d)\n", texh); printf(" -gap # gap between glyphs (def=%d)\n", gap); - printf(" -bitmap use a bitmap encoding (default)\n", gap); - printf(" -byte use a byte encoding (less compact)\n", gap); + printf(" -bitmap use a bitmap encoding (default)\n"); + printf(" -byte use a byte encoding (less compact)\n"); printf(" -glist ABC glyph list (def=%s)\n", glist); printf(" -fn name X font name (def=%s)\n", fontname); printf(" -file name output file for textured font (def=%s)\n", fontname); @@ -457,7 +455,7 @@ main(int argc, char *argv[]) { } texarea = calloc(texw * texh, sizeof(unsigned char)); - glist = (unsigned char *) nodupstring((char *) glist); + glist = nodupstring((char *) glist); dpy = XOpenDisplay(NULL); @@ -507,7 +505,7 @@ main(int argc, char *argv[]) { remaining space on the current row. */ int foundWidthFit = 0; - int c; + int c = 0; getMetric(fontinfo, glist[i], &tgi); width = tgi.width; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: bogglez <bo...@us...> - 2017-03-09 23:50:41
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via c627b1798d8c845cd78a64314451a4daaa2c55dd (commit) via 626b4c782d3fcbbe0a02fb20f89c1408a0230278 (commit) via bfbe0a0bf4d61bd53304a6c82a175c7c70d8b7dc (commit) from 271c2a9383dbb811e5c753b14beac47fb18e3eb6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c627b1798d8c845cd78a64314451a4daaa2c55dd Author: bogglez <bo...@pr...> Date: Fri Mar 10 00:50:19 2017 +0100 man: remove empty SEE ALSO commit 626b4c782d3fcbbe0a02fb20f89c1408a0230278 Author: bogglez <bo...@pr...> Date: Fri Mar 10 00:49:38 2017 +0100 bincnv: add man page commit bfbe0a0bf4d61bd53304a6c82a175c7c70d8b7dc Author: bogglez <bo...@pr...> Date: Fri Mar 10 00:49:21 2017 +0100 bincnv: error checking, some refactoring ----------------------------------------------------------------------- Summary of changes: utils/bincnv/bincnv.8 | 28 +++++ utils/bincnv/bincnv.c | 248 +++++++++++++++++++++++++++----------------- utils/dcbumpgen/dcbumpgen.1 | 1 - utils/scramble/scramble.1 | 1 - utils/wav2adpcm/wav2adpcm.1 | 1 - 5 files changed, 183 insertions(+), 96 deletions(-) create mode 100644 utils/bincnv/bincnv.8 diff --git a/utils/bincnv/bincnv.8 b/utils/bincnv/bincnv.8 new file mode 100644 index 0000000..bbfcad1 --- /dev/null +++ b/utils/bincnv/bincnv.8 @@ -0,0 +1,28 @@ +.TH BINCNV 8 "Mar 2017" "Version 1.0" +.SH NAME +bincnv \- Test ELF to BIN converter +.SH SYNOPSIS +.B bincnv +[ +.B \-d +] +.IR from +.IR to + +.SH DESCRIPTION +.B bincnv +is used to test the ELF to BIN converter. +Loads to VMA 0x8c010000. This is an exact functional duplicate of the routine +in process/elf.c and is used for testing new changes first. +.SH EXAMPLES + +.EX +.B + bincnv from.elf to.bin +.EE + +.SH AUTHOR +This manual page was initially written by Stefan Galowicz <bo...@pr...>, +for the KOS project. +.TP +The program has been initially written by Dan Potter in 2000. diff --git a/utils/bincnv/bincnv.c b/utils/bincnv/bincnv.c index 08abee3..516bd56 100644 --- a/utils/bincnv/bincnv.c +++ b/utils/bincnv/bincnv.c @@ -11,6 +11,7 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> #define uint8 unsigned char #define uint16 unsigned short @@ -132,89 +133,152 @@ int find_sym(char *name, struct elf_sym_t* table, int tablelen) { return -1; } -/* There's a lot of shit in here that's not documented or very poorly - documented by Intel.. I hope that this works for future compilers. */ -void *elf_load(FILE *f, uint32 vma, int* outsz) { - char *img, *imgout; - int sz, i, j, sect; - struct elf_hdr_t *hdr; - struct elf_shdr_t *shdrs, *symtabhdr; - struct elf_sym_t *symtab; - int symtabsize; - struct elf_rela_t *reltab; - int reltabsize; - char *stringtab; - - /* Load the file */ +static int write_file_contents(char const * const filename, void * data, size_t size) { + FILE * f = fopen(filename, "wb"); + int ret = f && fwrite(data, size, 1, f) == 1; + fclose(f); + return ret; +} + +/** + * Helper function to load the raw texture data into an array. + * @param filename The filename of the texture. + * @param data A pointer to an array where the data should be stored. + * @param size A pointer to a variable where to size should be stored. + * @return 0 on success, non-zero on error. + */ +static int read_file_contents(char const * const filename, char **data, size_t *size) { + FILE *f = 0; + + f = fopen(filename, "rb"); + + // Read texture from file + if(!f) { + return 1; + } + fseek(f, 0, SEEK_END); - sz = ftell(f); - fseek(f, 0, SEEK_SET); - img = malloc(sz); - fread(img, sz, 1, f); + long imageSize = ftell(f); + rewind(f); + + *data = malloc(imageSize); + if(!*data) { + fclose(f); + return 2; + } + + if(fread(*data, imageSize, 1, f) != 1) { + free(*data); + fclose(f); + return 3; + } + fclose(f); - /* Header is at the front */ - hdr = (struct elf_hdr_t *)(img + 0); + *size = imageSize; + + return 0; +} + +static int build_memory_image(struct elf_shdr_t * shdrs, uint16 shnum) { + uint16 i; + size_t sz = 0; + for(i = 0; i < shnum; i++) { + if(shdrs[i].flags & SHF_ALLOC) { + shdrs[i].addr = sz; + sz += shdrs[i].size; + + if(shdrs[i].addralign && (shdrs[i].addr % shdrs[i].addralign)) { + shdrs[i].addr = (shdrs[i].addr + shdrs[i].addralign) + & ~(shdrs[i].addralign - 1); + } + } + } + + return sz; +} + +#define ERROR(...) { ret = 1; fprintf(stderr, __VA_ARGS__); goto cleanup; } + +/* There's a lot of shit in here that's not documented or very poorly + documented by Intel.. I hope that this works for future compilers. */ +static int elf_load(char ** out, size_t * outsz, char const * const filename, uint32 vma) { + int ret = 0; + char * img = 0; + char * imgout = 0; + size_t sz; + int i; + int j; + int sect; + struct elf_hdr_t * hdr; + struct elf_shdr_t * shdrs; + struct elf_shdr_t * symtabhdr; + struct elf_sym_t * symtab; + int symtabsize; + struct elf_rela_t * reltab; + int reltabsize; + char * stringtab; + + + if(read_file_contents(filename, &img, &sz)) { + ERROR("Cannot allocate memory.\n"); + } + + hdr = (struct elf_hdr_t*)img; - if(hdr->ident[0] != 0x7f || strncmp(hdr->ident + 1, "ELF", 3)) { - printf("File is not a valid ELF file\n"); - return NULL; + if(hdr->ident[0] != 0x7f || memcmp(hdr->ident + 1, "ELF", 3)) { + ERROR("File is not a valid ELF file\n"); } if(hdr->ident[4] != 1 || hdr->ident[5] != 1) { - printf("Invalid architecture flags in ELF file\n"); - return NULL; + ERROR("Invalid architecture flags in ELF file\n"); } if(hdr->machine != 0x2a) { - printf("Invalid architecture %02x in ELF file\n", hdr->machine); + ERROR("Invalid architecture %02x in ELF file\n", hdr->machine); } /* Print some debug info */ - printf("File size is %d bytes\n", sz); - printf(" entry point %08x\n", hdr->entry); - printf(" ph offset %08x\n", hdr->phoff); - printf(" sh offset %08x\n", hdr->shoff); - printf(" flags %08x\n", hdr->flags); - printf(" ehsize %08x\n", hdr->ehsize); - printf(" phentsize %08x\n", hdr->phentsize); - printf(" phnum %08x\n", hdr->phnum); - printf(" shentsize %08x\n", hdr->shentsize); - printf(" shnum %08x\n", hdr->shnum); - printf(" shstrndx %08x\n", hdr->shstrndx); + printf("File size is %zu bytes\n", sz); + printf(" entry point %08lx\n", hdr->entry); + printf(" ph offset %08lx\n", hdr->phoff); + printf(" sh offset %08lx\n", hdr->shoff); + printf(" flags %08lx\n", hdr->flags); + printf(" ehsize %08x\n", hdr->ehsize); + printf(" phentsize %08x\n", hdr->phentsize); + printf(" phnum %08x\n", hdr->phnum); + printf(" shentsize %08x\n", hdr->shentsize); + printf(" shnum %08x\n", hdr->shnum); + printf(" shstrndx %08x\n", hdr->shstrndx); /* Locate the string table; SH elf files ought to have two string tables, one for section names and one for object string names. We'll look for the latter. */ shdrs = (struct elf_shdr_t *)(img + hdr->shoff); - stringtab = NULL; + stringtab = 0; for(i = 0; i < hdr->shnum; i++) { - if(shdrs[i].type == SHT_STRTAB - && i != hdr->shstrndx) { + if(shdrs[i].type == SHT_STRTAB && i != hdr->shstrndx) { stringtab = (char*)(img + shdrs[i].offset); } } if(!stringtab) { - printf("ELF contains no object string table\n"); - return NULL; + ERROR("ELF contains no object string table\n"); } /* Locate the symbol table */ - symtabhdr = NULL; + symtabhdr = 0; for(i = 0; i < hdr->shnum; i++) { - if(shdrs[i].type == SHT_SYMTAB - || shdrs[i].type == SHT_DYNSYM) { + if(shdrs[i].type == SHT_SYMTAB || shdrs[i].type == SHT_DYNSYM) { symtabhdr = shdrs + i; break; } } if(!symtabhdr) { - printf("ELF contains no symbol table\n"); - return NULL; + ERROR("ELF contains no symbol table\n"); } symtab = (struct elf_sym_t *)(img + symtabhdr->offset); @@ -223,43 +287,33 @@ void *elf_load(FILE *f, uint32 vma, int* outsz) { /* Relocate symtab entries for quick access */ for(i = 0; i < symtabsize; i++) { symtab[i].name = (uint32)(stringtab + symtab[i].name); - printf("SYM: %s / %08x / %08x / %d\r\n", + printf("SYM: %s / %08lx / %08lx / %d\r\n", (char*)symtab[i].name, symtab[i].value, symtab[i].size, symtab[i].shndx); } for(i = 0; i < hdr->shnum; i++) { - printf(" Section %d: (%08x/%08x)\n", i, shdrs[i].name, shdrs[i].type); + printf(" Section %d: (%08lx/%08lx)\n", i, shdrs[i].name, shdrs[i].type); } /* Build the final memory image */ - sz = 0; - - for(i = 0; i < hdr->shnum; i++) { - if(shdrs[i].flags & SHF_ALLOC) { - shdrs[i].addr = sz; - sz += shdrs[i].size; - - if(shdrs[i].addralign && (shdrs[i].addr % shdrs[i].addralign)) { - shdrs[i].addr = - (shdrs[i].addr + shdrs[i].addralign) - & ~(shdrs[i].addralign - 1); - } - } - } - - printf("Final image is %d bytes\n", sz); + sz = build_memory_image(shdrs, hdr->shnum); + printf("Final image is %zu bytes\n", sz); imgout = malloc(sz); + if(!imgout) { + ERROR("Cannot allocate image.\n"); + goto cleanup; + } for(i = 0; i < hdr->shnum; i++) { if(shdrs[i].flags & SHF_ALLOC) { if(shdrs[i].type == SHT_NOBITS) { - printf("%d: setting %d bytes of zeros at %08x\n", + printf("%d: setting %ld bytes of zeros at %08lx\n", i, shdrs[i].size, shdrs[i].addr); memset(imgout + shdrs[i].addr, 0, shdrs[i].size); } else { - printf("%d: copying %d bytes from %08x to %08x\n", + printf("%d: copying %ld bytes from %08lx to %08lx\n", i, shdrs[i].size, shdrs[i].offset, shdrs[i].addr); memcpy(imgout + shdrs[i].addr, img + shdrs[i].offset, @@ -269,7 +323,7 @@ void *elf_load(FILE *f, uint32 vma, int* outsz) { } /* Find the RELA section; FIXME: More than one RELA section, REL sections */ - reltab = NULL; + reltab = 0; /*for (i=0; i<hdr->shnum; i++) { if (shdrs[i].type == SHT_RELA) { reltab = (struct elf_rela_t *)(img + shdrs[i].offset); @@ -278,7 +332,7 @@ void *elf_load(FILE *f, uint32 vma, int* outsz) { } if (!reltab) { printf("ELF contains no RELA section (did you use -r?)\n"); - return NULL; + return 0; } reltabsize = shdrs[i].size / sizeof(struct elf_rela_t); */ @@ -296,13 +350,12 @@ void *elf_load(FILE *f, uint32 vma, int* outsz) { int sym; if(ELF32_R_TYPE(reltab[j].info) != R_SH_DIR32) { - printf("ELF contains unknown RELA type %02x\r\n", + ERROR("ELF contains unknown RELA type %02x\r\n", ELF32_R_TYPE(reltab[j].info)); - return NULL; } sym = ELF32_R_SYM(reltab[j].info); - printf(" Writing REL %08x(%08x+%08x+%08x+%08x) -> %08x\r\n", + printf(" Writing REL %08lx(%08lx+%08lx+%08lx+%08lx) -> %08lx\r\n", vma + shdrs[symtab[sym].shndx].addr + symtab[sym].value + reltab[j].addend, vma, shdrs[symtab[sym].shndx].addr, symtab[sym].value, reltab[j].addend, vma + shdrs[sect].addr + reltab[j].offset); @@ -323,22 +376,19 @@ void *elf_load(FILE *f, uint32 vma, int* outsz) { mainsym = find_sym("_ko_main", symtab, symtabsize); if(mainsym < 0) { - printf("ELF contains no _ko_main\n"); - return NULL; + ERROR("ELF contains no _ko_main\n"); } getsvcsym = find_sym("_ko_get_svc", symtab, symtabsize); if(mainsym < 0) { - printf("ELF contains no _ko_get_svc\n"); - return NULL; + ERROR("ELF contains no _ko_get_svc\n"); } notifysym = find_sym("_ko_notify", symtab, symtabsize); if(notifysym < 0) { - printf("ELF contains no _ko_notify\n"); - return NULL; + ERROR("ELF contains no _ko_notify\n"); } /* Patch together getsvc and notify for now */ @@ -350,26 +400,38 @@ void *elf_load(FILE *f, uint32 vma, int* outsz) { + symtab[notifysym].value; } - free(img); - *outsz = sz; - return (void*)imgout; +cleanup: + if(!ret) { + *outsz = sz; + *out = imgout; + } + else if(imgout) { + free(imgout); + } + + if(img) free(img); + + return ret; } -void main(int argc, char **argv) { - FILE *f; - void *out; - int sz; +int main(int argc, char **argv) { + char * out; + size_t sz; - f = fopen(argv[1], "rb"); + if(argc != 3) { + puts("Usage: <infile> <outfile>"); + return 0; + } - if(!f) { - perror("Can't open input file"); - return; + if(elf_load(&out, &sz, argv[1], 0x8c010000)) { + fprintf(stderr, "Cannot load ELF file.\n"); + return 1; } - out = elf_load(f, 0x8c010000, &sz); + if(write_file_contents(argv[2], out, sz)) { + fprintf(stderr, "Cannot write image.\n"); + return 2; + } - f = fopen(argv[2], "wb"); - fwrite(out, sz, 1, f); - fclose(f); + return 0; } diff --git a/utils/dcbumpgen/dcbumpgen.1 b/utils/dcbumpgen/dcbumpgen.1 index 982ee26..4a1bd99 100644 --- a/utils/dcbumpgen/dcbumpgen.1 +++ b/utils/dcbumpgen/dcbumpgen.1 @@ -27,4 +27,3 @@ This manual page was initially written by Stefan Galowicz <bo...@pr... for the KOS project. .TP The program has been initially written by Frederik Ehnbom in 2005. -.SH SEE ALSO diff --git a/utils/scramble/scramble.1 b/utils/scramble/scramble.1 index a8adc66..2f96ca1 100644 --- a/utils/scramble/scramble.1 +++ b/utils/scramble/scramble.1 @@ -37,4 +37,3 @@ for the KOS project. .TP The program has been initially written by Marcus Comstedt and was obtained from his site (http://mc.pp.se/dc/). -.SH SEE ALSO diff --git a/utils/wav2adpcm/wav2adpcm.1 b/utils/wav2adpcm/wav2adpcm.1 index 3ea34f5..dc4bc7e 100644 --- a/utils/wav2adpcm/wav2adpcm.1 +++ b/utils/wav2adpcm/wav2adpcm.1 @@ -36,4 +36,3 @@ This manual page was initially written by Stefan Galowicz <bo...@pr... for the KOS project. .TP The program has been initially written by BERO <be...@ge...> and modified by Dan Potter. -.SH SEE ALSO hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: bogglez <bo...@us...> - 2017-03-09 21:41:48
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 271c2a9383dbb811e5c753b14beac47fb18e3eb6 (commit) from 142eb5331239ff58d71700dd9ae768d18a9c0c8d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 271c2a9383dbb811e5c753b14beac47fb18e3eb6 Author: bogglez <bo...@pr...> Date: Thu Mar 9 22:41:25 2017 +0100 bin2c: add man page ----------------------------------------------------------------------- Summary of changes: utils/bin2c/bin2c.8 | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 utils/bin2c/bin2c.8 diff --git a/utils/bin2c/bin2c.8 b/utils/bin2c/bin2c.8 new file mode 100644 index 0000000..72692a6 --- /dev/null +++ b/utils/bin2c/bin2c.8 @@ -0,0 +1,31 @@ +.TH BIN2C 1 "Mar 2017" "Version 1.0" +.SH NAME +bin2c \- Convert a binary file into a C integer array +.SH SYNOPSIS +.B bin2c +.IR from +.IR to +[ +.IR prefix +] + +.SH DESCRIPTION +.B bin2c +is used to convert binary files into C integer arrays. +The generated code can be passed to the compiler to embed files +directly into an executable without using file operations. + +Generates variables int \fIprefix\fR_size and unsigned char \fIprefix\fR_data. + +.SH EXAMPLES + +.EX +.B + bin2c sonic.3ds mesh_sonic.c sonic +.EE + +.SH AUTHOR +This manual page was initially written by Stefan Galowicz <bo...@pr...>, +for the KOS project. +.TP +The program has been initially written by Dan Potter in 2000. hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: bogglez <bo...@us...> - 2017-03-09 21:30:56
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 142eb5331239ff58d71700dd9ae768d18a9c0c8d (commit) via d883a8c45921db534134dfac7adf80afc7cd37e3 (commit) from d0be8ed7e09cc721d45d4ba38266d0a10e07598e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 142eb5331239ff58d71700dd9ae768d18a9c0c8d Author: bogglez <bo...@pr...> Date: Thu Mar 9 22:30:31 2017 +0100 kmgenc: use same readpng code as vqenc/dcbumpgen, io errors commit d883a8c45921db534134dfac7adf80afc7cd37e3 Author: bogglez <bo...@pr...> Date: Thu Mar 9 22:29:52 2017 +0100 kmgenc: add man page ----------------------------------------------------------------------- Summary of changes: utils/kmgenc/kmgenc.1 | 45 +++++++++++++++++++++++++++++++++++++++++++++ utils/kmgenc/readpng.c | 12 +++++++----- utils/kmgenc/readpng.h | 2 +- 3 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 utils/kmgenc/kmgenc.1 diff --git a/utils/kmgenc/kmgenc.1 b/utils/kmgenc/kmgenc.1 new file mode 100644 index 0000000..28015eb --- /dev/null +++ b/utils/kmgenc/kmgenc.1 @@ -0,0 +1,45 @@ +.TH KMGENC 1 "Mar 2017" "Version 1.0" +.SH NAME +kmgenc \- Store images as SEGA Dreamcast PVR textures in a KMG container +.SH SYNOPSIS +\fBkmgenc\fR [\fIOPTION\fR]... [\fIFILE\fR]... + +.SH DESCRIPTION +.B kmgenc +is used to convert images to the SEGA Dreamcast's available +image formats. Typically this means RGB565, ARGB1555 or ARGB4444. + +.SH OPTIONS +.TP +.BR \-v ", " \-\-verbose\fR +Print more information during processing. + +.TP +.BR \-d ", " \-\-debug\fR +Print much more information. + +.TP +.BR \-a4 ", " \-\-argb4444\fR +Use 4 bit alpha channel (Dreamcast PVR texture format ARGB4444). + +.TP +.BR \-a1 ", " \-\-argb1555\fR +Use 1 bit alpha channel (Dreamcast PVR texture format ARGB1555). + +.SH EXAMPLES + +.EX +.B + kmgenc -a image.png +.EE + +.SH AUTHOR +This manual page was initially written by Stefan Galowicz <bo...@pr...>, +for the KOS project. +.TP +The program has been initially written by Gil Megidish in 2002 and modified by +Dan Potter in 2003. + +.SH BUGS +kmgenc is very incomplete and you may want to use vqenc instead, since it is also +capable of outputting kmg container files with mipmaps and VQ compression. diff --git a/utils/kmgenc/readpng.c b/utils/kmgenc/readpng.c index 642fdeb..788f100 100644 --- a/utils/kmgenc/readpng.c +++ b/utils/kmgenc/readpng.c @@ -25,7 +25,7 @@ void readpng_version_info(void) { } -/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 4 for no mem */ +/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 3 for io, 4 for no mem */ uint32 readpng_init(FILE *infile) { uint8 sig[8]; @@ -33,7 +33,9 @@ uint32 readpng_init(FILE *infile) { /* first do a quick check that the file really is a PNG image; could * have used slightly more general png_sig_cmp() function instead */ - fread(sig, 1, 8, infile); + if(fread(sig, 8, 1, infile) != 1) { + return 3; + } if(!png_check_sig(sig, 8)) return 1; /* bad signature */ @@ -62,7 +64,7 @@ uint32 readpng_init(FILE *infile) { return 0; } -uint8 *readpng_get_image(uint32 *pChannels, uint32 *pRowbytes, uint32 *pWidth, uint32 *pHeight) { +uint8 *readpng_get_image(uint32 *pChannels, uint32 *pRowbytes, int *pWidth, int *pHeight) { png_uint_32 width, height; int bit_depth, color_type; uint8 *image_data = NULL; @@ -77,8 +79,8 @@ uint8 *readpng_get_image(uint32 *pChannels, uint32 *pRowbytes, uint32 *pWidth, u png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, NULL, NULL, NULL); - *pWidth = width; - *pHeight = height; + *pWidth = (int)width; + *pHeight = (int)height; /* expand palette images to RGB, low-bit-depth grayscale images to 8 bits, * transparency chunks to full alpha channel; strip 16-bit-per-sample diff --git a/utils/kmgenc/readpng.h b/utils/kmgenc/readpng.h index af0cc29..1c4a034 100644 --- a/utils/kmgenc/readpng.h +++ b/utils/kmgenc/readpng.h @@ -35,6 +35,6 @@ uint32 readpng_init(FILE *infile); * The caller is responsible for freeing the memory */ uint8 *readpng_get_image(uint32 *pNumChannels, - uint32 *pRowBytes, uint32 *pWidth, uint32 *pHeight); + uint32 *pRowBytes, int *pWidth, int *pHeight); void readpng_cleanup(void); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: bogglez <bo...@us...> - 2017-03-09 20:50:18
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via d0be8ed7e09cc721d45d4ba38266d0a10e07598e (commit) via df9dfa1a494c9ba871318eee506683c3557be9e2 (commit) via ee28c5cfb5cbd98a4f29393f8d157b4e67674aab (commit) from 8b2a2967d2d77973b50c5fa01fcb27932f70d522 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d0be8ed7e09cc721d45d4ba38266d0a10e07598e Author: bogglez <bo...@pr...> Date: Thu Mar 9 21:49:43 2017 +0100 dcbumpgen: check errors - check dimensions power of two - check fopen - check 2 mallocs - check fwrite - cleanup ressources at end of function commit df9dfa1a494c9ba871318eee506683c3557be9e2 Author: bogglez <bo...@pr...> Date: Thu Mar 9 21:44:28 2017 +0100 dcbumpgen: use readpng code from vqenc, io errors commit ee28c5cfb5cbd98a4f29393f8d157b4e67674aab Author: bogglez <bo...@pr...> Date: Thu Mar 9 21:39:26 2017 +0100 dcbumpgen: add man page ----------------------------------------------------------------------- Summary of changes: utils/dcbumpgen/dcbumpgen.1 | 30 ++++++++++ utils/dcbumpgen/dcbumpgen.c | 61 +++++++++++++------- utils/dcbumpgen/get_image_png.c | 121 ++++++++++++++++++++-------------------- utils/dcbumpgen/readpng.c | 79 ++++++++++++++------------ utils/dcbumpgen/readpng.h | 10 ++-- 5 files changed, 179 insertions(+), 122 deletions(-) create mode 100644 utils/dcbumpgen/dcbumpgen.1 diff --git a/utils/dcbumpgen/dcbumpgen.1 b/utils/dcbumpgen/dcbumpgen.1 new file mode 100644 index 0000000..982ee26 --- /dev/null +++ b/utils/dcbumpgen/dcbumpgen.1 @@ -0,0 +1,30 @@ +.TH DCBUMPGEN 1 "Mar 2017" "Version 1.0" +.SH NAME +dcbumpgen \- dcbumpgen a Dreamcast executable +.SH SYNOPSIS +.B dcbumpgen +.IR from +.IR to + +.SH DESCRIPTION +.B dcbumpgen +is used to generate SEGA Dreamcast PVR bumpmap textures. + +.SH EXAMPLES + +.EX +.B + dcbumpgen infile.png outfile.raw +.EE + +.EX +.B + dcbumpgen infile.jpg outfile.raw +.EE + +.SH AUTHOR +This manual page was initially written by Stefan Galowicz <bo...@pr...>, +for the KOS project. +.TP +The program has been initially written by Frederik Ehnbom in 2005. +.SH SEE ALSO diff --git a/utils/dcbumpgen/dcbumpgen.c b/utils/dcbumpgen/dcbumpgen.c index 7f3d241..b91b7d0 100644 --- a/utils/dcbumpgen/dcbumpgen.c +++ b/utils/dcbumpgen/dcbumpgen.c @@ -35,41 +35,61 @@ */ #include "get_image.h" -void printUsage() { +static void printUsage() { printf("dcbumpgen - Dreamcast bumpmap generator v0.1\n"); printf("Copyright (c) 2005 Fredrik Ehnbom\n"); printf("usage: dcbumpgen <infile.png/.jpg> <outfile.raw>\n"); } +static int isPowerOfTwo(unsigned x) +{ + return x && !(x & (x-1)); +} + /* twiddling stuff copied from kmgenc.c */ #define TWIDTAB(x) ( (x&1)|((x&2)<<1)|((x&4)<<2)|((x&8)<<3)|((x&16)<<4)| \ ((x&32)<<5)|((x&64)<<6)|((x&128)<<7)|((x&256)<<8)|((x&512)<<9) ) #define TWIDOUT(x, y) ( TWIDTAB((y)) | (TWIDTAB((x)) << 1) ) #define MIN(a, b) ( (a)<(b)? (a):(b) ) +#define ERROR(...) { ret = 1; fprintf(stderr, __VA_ARGS__); goto cleanup; } + int main(int argc, char **argv) { - image_t img; - FILE *fp; + int ret = 0; int y, x; - unsigned char *buffer; int imgpos, dest; + image_t img = {0}; + FILE *fp = 0; + unsigned char *buffer = 0; + short * twidbuffer = 0; if (argc != 3) { printUsage(); - exit(1); + return 0; } if (get_image(argv[1], &img) < 0) { - fprintf(stderr, "couldn't open %s\n", argv[1]); - return -1; + ERROR("Cannot open %s\n", argv[1]); } - /* TODO: - * - error-checking for missing files and other file failures - * - check that image is power of two - */ fp = fopen(argv[2], "wb"); + if(!fp) { + ERROR("Cannot open file %s!\n", argv[2]); + } + buffer = malloc(2 * img.w * img.h); + if(!buffer) { + ERROR("Cannot allocate memory for image data!\n"); + } + + twidbuffer = malloc(2 * img.w * img.h); + if(!buffer) { + ERROR("Cannot allocate memory for twiddle buffer!\n"); + } + + if(!isPowerOfTwo(img.w) || !isPowerOfTwo(img.h)) { + ERROR("Image dimensions %ux%u are not a power of two!\n", img.w, img.h); + } imgpos = 1; /* 1 to skip the alpha-channel */ dest = 0; @@ -101,7 +121,6 @@ int main(int argc, char **argv) { int min = MIN(img.w, img.h); int mask = min-1; short *sbuffer = (short*) buffer; - short *twidbuffer = malloc(2 * img.w * img.h); for (y=0; y<img.h; y++) { int yout = y; for (x=0; x<img.w; x++) { @@ -110,14 +129,16 @@ int main(int argc, char **argv) { } } - fwrite(twidbuffer, 1, 2* img.w * img.h, fp); - fclose(fp); - - free(buffer); - free(twidbuffer); - if (img.data) { - free(img.data); + if(fwrite(twidbuffer, 2* img.w * img.h, 1, fp) != 1) { + ERROR("Cannot write twiddle buffer!\n"); } - return 0; + +cleanup: + if(fp) fclose(fp); + if(buffer) free(buffer); + if(twidbuffer) free(twidbuffer); + if(img.data) free(img.data); + + return ret; } diff --git a/utils/dcbumpgen/get_image_png.c b/utils/dcbumpgen/get_image_png.c index aec635d..3668167 100644 --- a/utils/dcbumpgen/get_image_png.c +++ b/utils/dcbumpgen/get_image_png.c @@ -8,8 +8,8 @@ */ #include <assert.h> -#include <stdlib.h> #include <png.h> +#include <stdlib.h> #include "readpng.h" #include "get_image.h" @@ -17,79 +17,78 @@ /* not to be used outside of here */ void _png_copy_texture(uint8 *buffer, uint8 *temp_tex, - uint32 channels, uint32 stride, - uint32 w, uint32 h) -{ - uint32 i,j; - uint8 *ourbuffer; - uint8 *pRow; - - for(i = 0; i < h; i++) { - pRow = &buffer[i*stride]; - ourbuffer = &temp_tex[i*w*4]; - - if (channels == 3) { - for (j=0; j<w; j++) { - ourbuffer[j*4+0] = 0xff; - ourbuffer[j*4+1] = pRow[j*3+0]; - ourbuffer[j*4+2] = pRow[j*3+1]; - ourbuffer[j*4+3] = pRow[j*3+2]; - } - } - else if (channels == 4) { - for (j=0; j<w; j++) { - ourbuffer[j*4+0] = pRow[j*4+3]; - ourbuffer[j*4+1] = pRow[j*4+0]; - ourbuffer[j*4+2] = pRow[j*4+1]; - ourbuffer[j*4+3] = pRow[j*4+2]; - } + uint32 channels, uint32 stride, + uint32 w, uint32 h) { + uint32 i, j; + uint8 *ourbuffer; + uint8 *pRow; + + for(i = 0; i < h; i++) { + pRow = &buffer[i * stride]; + ourbuffer = &temp_tex[i * w * 4]; + + if(channels == 3) { + for(j = 0; j < w; j++) { + ourbuffer[j * 4 + 0] = 0xff; + ourbuffer[j * 4 + 1] = pRow[j * 3]; + ourbuffer[j * 4 + 2] = pRow[j * 3 + 1]; + ourbuffer[j * 4 + 3] = pRow[j * 3 + 2]; + } + } + else if(channels == 4) { + for(j = 0; j < w; j++) { + ourbuffer[j * 4 + 0] = pRow[j * 4 + 3]; + ourbuffer[j * 4 + 1] = pRow[j * 4 + 0]; + ourbuffer[j * 4 + 2] = pRow[j * 4 + 1]; + ourbuffer[j * 4 + 3] = pRow[j * 4 + 2]; + } + } } - } } int get_image_png(const char * filename, image_t * image) { - uint8 *temp_tex; + uint8 *temp_tex; - /* More stuff */ - uint8 *buffer; /* Output row buffer */ - uint32 row_stride; /* physical row width in output buffer */ - uint32 channels; /* 3 for RGB 4 for RGBA */ + /* More stuff */ + uint8 *buffer; /* Output row buffer */ + uint32 row_stride; /* physical row width in output buffer */ + uint32 channels; /* 3 for RGB 4 for RGBA */ - FILE *infile; /* source file */ + FILE *infile; /* source file */ - assert( image != NULL ); + assert(image != NULL); - if ((infile = fopen(filename, "rb")) == 0) { - printf("png_to_texture: can't open %s\n", filename); - return -1; - } + if((infile = fopen(filename, "rb")) == 0) { + printf("png_to_texture: can't open %s\n", filename); + return -1; + } - /* Step 1: Initialize loader */ - if (readpng_init(infile)) { - fclose(infile); - return -2; - } + /* Step 1: Initialize loader */ + if(readpng_init(infile)) { + fclose(infile); + return -2; + } - /* Step 1.5: Create output kos_img_t */ - /* rv = (kos_img_t *)malloc(sizeof(kos_img_t)); */ + /* Step 1.5: Create output kos_img_t */ + /* rv = (kos_img_t *)malloc(sizeof(kos_img_t)); */ - /* Step 2: Read file */ - buffer = readpng_get_image(&channels, &row_stride, &image->w, &image->h); - temp_tex = (uint8 *)malloc(sizeof(uint8) * 4 * image->w * image->h); - image->data = (unsigned char *)temp_tex; - image->bpp = 4; - image->stride = image->w*4; + /* Step 2: Read file */ + buffer = readpng_get_image(&channels, &row_stride, &image->w, &image->h); + temp_tex = (uint8 *)malloc(sizeof(uint8) * 4 * image->w * image->h); + image->data = (unsigned char *)temp_tex; + image->bpp = 4; + image->stride = image->w * 4; - _png_copy_texture(buffer, temp_tex, - channels, row_stride, - image->w, image->h); + _png_copy_texture(buffer, temp_tex, + channels, row_stride, + image->w, image->h); - /* Step 3: Finish decompression */ - free(buffer); - readpng_cleanup(); + /* Step 3: Finish decompression */ + free(buffer); + readpng_cleanup(); - fclose(infile); + fclose(infile); - /* And we're done! */ - return 0; + /* And we're done! */ + return 0; } diff --git a/utils/dcbumpgen/readpng.c b/utils/dcbumpgen/readpng.c index f9372d7..788f100 100644 --- a/utils/dcbumpgen/readpng.c +++ b/utils/dcbumpgen/readpng.c @@ -3,7 +3,6 @@ readpng.c Copyright (C)2002 Jeffrey McBeth - $Id: readpng.c,v 1.1 2003/04/24 03:19:42 bardtx Exp $ */ /* Modified for vqenc by Dan Potter */ @@ -11,43 +10,46 @@ #include <stdio.h> #include <stdlib.h> -#include <png.h> /* libpng header */ +#include <png.h> /* libpng header; includes zlib.h */ #include <zlib.h> #include "readpng.h" /* typedefs, common macros, public prototypes */ static png_structp png_ptr = NULL; static png_infop info_ptr = NULL; -void readpng_version_info(void) -{ +void readpng_version_info(void) { fprintf(stderr, " Compiled with libpng %s; using libpng %s.\n", - PNG_LIBPNG_VER_STRING, png_libpng_ver); + PNG_LIBPNG_VER_STRING, png_libpng_ver); fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n", - ZLIB_VERSION, zlib_version); + ZLIB_VERSION, zlib_version); } -/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 4 for no mem */ +/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 3 for io, 4 for no mem */ -uint32 readpng_init(FILE *infile) -{ +uint32 readpng_init(FILE *infile) { uint8 sig[8]; /* first do a quick check that the file really is a PNG image; could * have used slightly more general png_sig_cmp() function instead */ - fread(sig, 1, 8, infile); - if (!png_check_sig(sig, 8)) + if(fread(sig, 8, 1, infile) != 1) { + return 3; + } + + if(!png_check_sig(sig, 8)) return 1; /* bad signature */ /* could pass pointers to user-defined error handlers instead of NULLs: */ png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - if (!png_ptr) + + if(!png_ptr) return 4; /* out of memory */ info_ptr = png_create_info_struct(png_ptr); - if (!info_ptr) { + + if(!info_ptr) { png_destroy_read_struct(&png_ptr, NULL, NULL); return 4; /* out of memory */ } @@ -62,39 +64,42 @@ uint32 readpng_init(FILE *infile) return 0; } -uint8 *readpng_get_image(uint32 *pChannels, uint32 *pRowbytes, uint32 *pWidth, uint32 *pHeight) -{ - png_uint_32 width, height; - int bit_depth, color_type; - uint8 *image_data = NULL; - png_uint_32 i, rowbytes; - png_bytepp row_pointers = NULL; +uint8 *readpng_get_image(uint32 *pChannels, uint32 *pRowbytes, int *pWidth, int *pHeight) { + png_uint_32 width, height; + int bit_depth, color_type; + uint8 *image_data = NULL; + png_uint_32 i, rowbytes; + png_bytepp row_pointers = NULL; /* alternatively, could make separate calls to png_get_image_width(), * etc., but want bit_depth and color_type for later [don't care about * compression_type and filter_type => NULLs] */ - png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, - NULL, NULL, NULL); + png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, + NULL, NULL, NULL); - *pWidth = width; - *pHeight = height; + *pWidth = (int)width; + *pHeight = (int)height; /* expand palette images to RGB, low-bit-depth grayscale images to 8 bits, * transparency chunks to full alpha channel; strip 16-bit-per-sample * images to 8 bits per sample; and convert grayscale to RGB[A] */ - if (color_type == PNG_COLOR_TYPE_PALETTE) + if(color_type == PNG_COLOR_TYPE_PALETTE) png_set_expand(png_ptr); - if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) + + if(color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) png_set_expand(png_ptr); - if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) + + if(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) png_set_expand(png_ptr); - if (bit_depth == 16) + + if(bit_depth == 16) png_set_strip_16(png_ptr); - if (color_type == PNG_COLOR_TYPE_GRAY || - color_type == PNG_COLOR_TYPE_GRAY_ALPHA) + + if(color_type == PNG_COLOR_TYPE_GRAY || + color_type == PNG_COLOR_TYPE_GRAY_ALPHA) png_set_gray_to_rgb(png_ptr); /* all transformations have been registered; now update info_ptr data, @@ -105,11 +110,12 @@ uint8 *readpng_get_image(uint32 *pChannels, uint32 *pRowbytes, uint32 *pWidth, u *pRowbytes = rowbytes = png_get_rowbytes(png_ptr, info_ptr); *pChannels = (int)png_get_channels(png_ptr, info_ptr); - if ((image_data = (uint8 *)malloc(rowbytes*height)) == NULL) { + if((image_data = (uint8 *)malloc(rowbytes * height)) == NULL) { png_destroy_read_struct(&png_ptr, &info_ptr, NULL); return NULL; } - if ((row_pointers = (png_bytepp)malloc(height*sizeof(png_bytep))) == NULL) { + + if((row_pointers = (png_bytepp)malloc(height * sizeof(png_bytep))) == NULL) { png_destroy_read_struct(&png_ptr, &info_ptr, NULL); free(image_data); image_data = NULL; @@ -121,8 +127,8 @@ uint8 *readpng_get_image(uint32 *pChannels, uint32 *pRowbytes, uint32 *pWidth, u /* set the individual row_pointers to point at the correct offsets */ - for (i = 0; i < height; ++i) - row_pointers[i] = image_data + i*rowbytes; + for(i = 0; i < height; ++i) + row_pointers[i] = image_data + i * rowbytes; /* now we can go ahead and just read the whole image */ @@ -137,9 +143,8 @@ uint8 *readpng_get_image(uint32 *pChannels, uint32 *pRowbytes, uint32 *pWidth, u } -void readpng_cleanup(void) -{ - if (png_ptr && info_ptr) { +void readpng_cleanup(void) { + if(png_ptr && info_ptr) { png_destroy_read_struct(&png_ptr, &info_ptr, NULL); png_ptr = NULL; info_ptr = NULL; diff --git a/utils/dcbumpgen/readpng.h b/utils/dcbumpgen/readpng.h index 8473a73..1c4a034 100644 --- a/utils/dcbumpgen/readpng.h +++ b/utils/dcbumpgen/readpng.h @@ -2,9 +2,11 @@ typedef unsigned short uint16; typedef unsigned char uint8; */ -#define uint32 unsigned int -#define uint16 unsigned short -#define uint8 unsigned char +#include <stdint.h> + +#define uint32 uint32_t +#define uint16 uint16_t +#define uint8 uint8_t #ifndef TRUE # define TRUE 1 @@ -33,6 +35,6 @@ uint32 readpng_init(FILE *infile); * The caller is responsible for freeing the memory */ uint8 *readpng_get_image(uint32 *pNumChannels, - uint32 *pRowBytes, uint32 *pWidth, uint32 *pHeight); + uint32 *pRowBytes, int *pWidth, int *pHeight); void readpng_cleanup(void); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: bogglez <bo...@us...> - 2017-03-09 20:13:48
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 8b2a2967d2d77973b50c5fa01fcb27932f70d522 (commit) via a0d7d05b457a6f29cbea29031eed9d07139d4c33 (commit) via 051aef6358189354a6a9f46687fe0f260af99574 (commit) from c77634aa22982a426e3423693e40a84c7a3b4ff1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8b2a2967d2d77973b50c5fa01fcb27932f70d522 Author: bogglez <bo...@pr...> Date: Thu Mar 9 21:13:13 2017 +0100 vqenc: handle fread error case commit a0d7d05b457a6f29cbea29031eed9d07139d4c33 Author: bogglez <bo...@pr...> Date: Thu Mar 9 21:12:58 2017 +0100 vqenc: fix pointer to int cast commit 051aef6358189354a6a9f46687fe0f260af99574 Author: bogglez <bo...@pr...> Date: Thu Mar 9 21:12:24 2017 +0100 vqenc: add manpage ----------------------------------------------------------------------- Summary of changes: utils/vqenc/readpng.c | 6 +++-- utils/vqenc/vqenc.1 | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++ utils/vqenc/vqenc.c | 2 +- 3 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 utils/vqenc/vqenc.1 diff --git a/utils/vqenc/readpng.c b/utils/vqenc/readpng.c index 1b93e4c..788f100 100644 --- a/utils/vqenc/readpng.c +++ b/utils/vqenc/readpng.c @@ -25,7 +25,7 @@ void readpng_version_info(void) { } -/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 4 for no mem */ +/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 3 for io, 4 for no mem */ uint32 readpng_init(FILE *infile) { uint8 sig[8]; @@ -33,7 +33,9 @@ uint32 readpng_init(FILE *infile) { /* first do a quick check that the file really is a PNG image; could * have used slightly more general png_sig_cmp() function instead */ - fread(sig, 1, 8, infile); + if(fread(sig, 8, 1, infile) != 1) { + return 3; + } if(!png_check_sig(sig, 8)) return 1; /* bad signature */ diff --git a/utils/vqenc/vqenc.1 b/utils/vqenc/vqenc.1 new file mode 100644 index 0000000..136338e --- /dev/null +++ b/utils/vqenc/vqenc.1 @@ -0,0 +1,68 @@ +.TH VQENC 1 "Mar 2017" "Version 1.0" +.SH NAME +vqenc \- Compress images using SEGA Dreamcast Vector Quantization +.SH SYNOPSIS +\fBvqenc\fR [\fIOPTION\fR]... [\fIFILE\fR]... + +.SH DESCRIPTION +.B vqenc +is used to compress image files using the SEGA Dreamcast's Vector +Quantization algorithm. +At a small loss of quality this allows for textures of up to an +eighth of the original size, resulting in more and higher +resolution textures. + +.SH OPTIONS +.TP +.BR \-t ", " \-\-twiddle\fR +Arrange pixels in a recursive Z-pattern. +Makes texture filtering faster. +Requires square texture dimensions. + +.TP +.BR \-m ", " \-\-mipmap\fR +Calculate and store recursively smaller versions of the image. +Reduces bandwidth and makes texture filtering faster. +Adds about a third of file size. + +.TP +.BR \-v ", " \-\-verbose\fR +Print more information during processing. + +.TP +.BR \-d ", " \-\-debug\fR +Print much more information. + +.TP +.BR \-q ", " \-\-highq\fR +Allow conversion to take more time to achieve higher quality. + +.TP +.BR \-k ", " \-\-kmg\fR +Convert [\fIFILE\fR] to \fB.kmg\fR format instead of \fB.vq\fR. + +.TP +.BR \-a ", " \-\-alpha\fR +Use 4 bit alpha channel (Dreamcast PVR texture format ARGB4444). + +.TP +.BR \-b ", " \-\-amask\fR +Use 1 bit alpha channel (Dreamcast PVR texture format ARGB1555). + +.SH EXAMPLES + +.EX +.B + vqenc -t -m -q -a image.png +.EE + +.SH AUTHOR +This manual page was initially written by Stefan Galowicz <bo...@pr...>, +for the KOS project. +.TP +The program has been initially written by Jeffrey McBeth in 2002 and was modified +by Dan Potter. + +.SH BUGS +While the SEGA Dreamcast hardware can handle non-square VQ-compressed textures, this +tool is not capable of producing them. diff --git a/utils/vqenc/vqenc.c b/utils/vqenc/vqenc.c index bf07146..6660b93 100644 --- a/utils/vqenc/vqenc.c +++ b/utils/vqenc/vqenc.c @@ -572,7 +572,7 @@ static fquad_t *create_downscaled_map(int res, fquad_t *oneup) { fquad_t *q, *larger, tmp; if(use_debug) { - printf("create_downscaled_map(%d %x)\n", res, (unsigned)oneup); + printf("create_downscaled_map(%d %lx)\n", res, (uintptr_t)oneup); } /* each quad in the lower resolution is an average of hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: bogglez <bo...@us...> - 2017-03-09 19:39:11
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via c77634aa22982a426e3423693e40a84c7a3b4ff1 (commit) via b84b7774361980f07703cf443ce4bef0e0fae17a (commit) from 9303b215c101f710bc04cb40adc3f2ebad1a104a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c77634aa22982a426e3423693e40a84c7a3b4ff1 Author: bogglez <bo...@pr...> Date: Thu Mar 9 20:38:25 2017 +0100 wav2adpcm: add man page commit b84b7774361980f07703cf443ce4bef0e0fae17a Author: bogglez <bo...@pr...> Date: Thu Mar 9 20:37:44 2017 +0100 wav2adpcm: add fread/fwrite error detection ----------------------------------------------------------------------- Summary of changes: utils/wav2adpcm/wav2adpcm.1 | 39 ++++++++++++++++++++++++++++++++ utils/wav2adpcm/wav2adpcm.c | 54 +++++++++++++++++++++++++++++++++------------ 2 files changed, 79 insertions(+), 14 deletions(-) create mode 100644 utils/wav2adpcm/wav2adpcm.1 diff --git a/utils/wav2adpcm/wav2adpcm.1 b/utils/wav2adpcm/wav2adpcm.1 new file mode 100644 index 0000000..3ea34f5 --- /dev/null +++ b/utils/wav2adpcm/wav2adpcm.1 @@ -0,0 +1,39 @@ +.TH WAV2ADPCM 1 "Mar 2017" "Version 1.0" +.SH NAME +wav2adpcm \- Convert between WAV and ADPCM audio data +.SH SYNOPSIS +.B wav2adpcm +.B \-t +.B \-f +.IR from.wav +.IR to.wav + +.SH DESCRIPTION +.B wav2adpcm +is used to convert WAV audio data to the ADPCM format supported by the +hardware of the SEGA Dreamcast game console. +.SH OPTIONS +.TP +.BI -t +Convert from WAV to ADPCM +.BI -f +Convert from ADPCM to WAV + +.SH EXAMPLES + +.EX +.B + wav2adpcm -t from.wav to_adpcm.wav +.EE + +.EX +.B + wav2adpcm -f from_adpcm.wav to.wav +.EE + +.SH AUTHOR +This manual page was initially written by Stefan Galowicz <bo...@pr...>, +for the KOS project. +.TP +The program has been initially written by BERO <be...@ge...> and modified by Dan Potter. +.SH SEE ALSO diff --git a/utils/wav2adpcm/wav2adpcm.c b/utils/wav2adpcm/wav2adpcm.c index 06e2ec2..02e5a5f 100644 --- a/utils/wav2adpcm/wav2adpcm.c +++ b/utils/wav2adpcm/wav2adpcm.c @@ -190,12 +190,16 @@ int wav2adpcm(const char *infile, const char *outfile) { in = fopen(infile, "rb"); - if(in == NULL) { + if(!in) { printf("can't open %s\n", infile); return -1; } - fread(&wavhdr, 1, sizeof(wavhdr), in); + if(fread(&wavhdr, sizeof(wavhdr), 1, in) != 1) { + fprintf(stderr, "Cannot read header.\n"); + fclose(in); + return -1; + } if(memcmp(wavhdr.hdr1, "RIFF", 4) || memcmp(wavhdr.hdr2, "WAVEfmt ", 8) @@ -204,7 +208,7 @@ int wav2adpcm(const char *infile, const char *outfile) { || wavhdr.format != 1 || (wavhdr.channels != 1 && wavhdr.channels != 2) || wavhdr.bits != 16) { - printf("unsupport format\n"); + fprintf(stderr, "Unsupported format.\n"); fclose(in); return -1; } @@ -215,7 +219,11 @@ int wav2adpcm(const char *infile, const char *outfile) { pcmbuf = malloc(pcmsize); adpcmbuf = malloc(adpcmsize); - fread(pcmbuf, 1, pcmsize, in); + if(fread(pcmbuf, pcmsize, 1, in) != 1) { + fprintf(stderr, "Cannot read data.\n"); + fclose(in); + return -1; + } fclose(in); if(wavhdr.channels == 1) { @@ -229,13 +237,18 @@ int wav2adpcm(const char *infile, const char *outfile) { pcm2adpcm(adpcmbuf + adpcmsize / 2, pcmbuf + pcmsize / 4, pcmsize / 2); } - out = fopen(outfile, "wb"); wavhdr.datasize = adpcmsize; wavhdr.format = 20; /* ITU G.723 ADPCM (Yamaha) */ wavhdr.bits = 4; wavhdr.totalsize = wavhdr.datasize + sizeof(wavhdr) - 8; - fwrite(&wavhdr, 1, sizeof(wavhdr), out); - fwrite(adpcmbuf, 1, adpcmsize, out); + + out = fopen(outfile, "wb"); + if(fwrite(&wavhdr, sizeof(wavhdr), 1, out) != 1 + || fwrite(adpcmbuf, adpcmsize, 1, out) != 1) { + fprintf(stderr, "Cannot write ADPCM data.\n"); + fclose(out); + return -1; + } fclose(out); return 0; @@ -250,12 +263,16 @@ int adpcm2wav(const char *infile, const char *outfile) { in = fopen(infile, "rb"); - if(in == NULL) { - printf("can't open %s\n", infile); + if(!in) { + fprintf(stderr, "Cannot open %s\n", infile); return -1; } - fread(&wavhdr, 1, sizeof(wavhdr), in); + if(fread(&wavhdr, sizeof(wavhdr), 1, in) != 1) { + fprintf(stderr, "Cannot read header.\n"); + fclose(in); + return -1; + } if(memcmp(wavhdr.hdr1, "RIFF", 4) || memcmp(wavhdr.hdr2, "WAVEfmt ", 8) @@ -264,7 +281,7 @@ int adpcm2wav(const char *infile, const char *outfile) { || wavhdr.format != 20 || (wavhdr.channels != 1 && wavhdr.channels != 2) || wavhdr.bits != 4) { - printf("unsupport format\n"); + fprintf(stderr, "Unsupported format.\n"); fclose(in); return -1; } @@ -274,7 +291,11 @@ int adpcm2wav(const char *infile, const char *outfile) { adpcmbuf = malloc(adpcmsize); pcmbuf = malloc(pcmsize); - fread(adpcmbuf, 1, adpcmsize, in); + if(fread(adpcmbuf, adpcmsize, 1, in) != 1) { + fprintf(stderr, "Cannot read data.\n"); + fclose(in); + return -1; + } fclose(in); if(wavhdr.channels == 1) { @@ -294,8 +315,13 @@ int adpcm2wav(const char *infile, const char *outfile) { wavhdr.bits = 16; out = fopen(outfile, "wb"); - fwrite(&wavhdr, 1, sizeof(wavhdr), out); - fwrite(pcmbuf, 1, pcmsize, out); + if(fwrite(&wavhdr, sizeof(wavhdr), 1, out) != 1 + || fwrite(pcmbuf, pcmsize, 1, out) != 1) { + fprintf(stderr, "Cannot write WAV data.\n"); + fclose(out); + return -1; + } + fclose(out); return 0; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: bogglez <bo...@us...> - 2017-03-09 19:12:56
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 9303b215c101f710bc04cb40adc3f2ebad1a104a (commit) via 4090180902c469879e6e57026facb40801f229b8 (commit) from 821bcbd45838c172837ab1e1ce01da8109f9d0a3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9303b215c101f710bc04cb40adc3f2ebad1a104a Author: bogglez <bo...@pr...> Date: Thu Mar 9 20:12:25 2017 +0100 scramble: add man page commit 4090180902c469879e6e57026facb40801f229b8 Author: bogglez <bo...@pr...> Date: Thu Mar 9 20:12:13 2017 +0100 genromfs: return 0 instead of undefined ret, oops ----------------------------------------------------------------------- Summary of changes: utils/genromfs/genromfs.c | 2 +- utils/scramble/scramble.1 | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 utils/scramble/scramble.1 diff --git a/utils/genromfs/genromfs.c b/utils/genromfs/genromfs.c index 702c9d3..7f98906 100644 --- a/utils/genromfs/genromfs.c +++ b/utils/genromfs/genromfs.c @@ -904,5 +904,5 @@ int main(int argc, char *argv[]) { return 1; } - return ret; + return 0; } diff --git a/utils/scramble/scramble.1 b/utils/scramble/scramble.1 new file mode 100644 index 0000000..a8adc66 --- /dev/null +++ b/utils/scramble/scramble.1 @@ -0,0 +1,40 @@ +.TH SCRAMBLE 1 "Mar 2017" "Version 1.0" +.SH NAME +scramble \- scramble a Dreamcast executable +.SH SYNOPSIS +.B scramble +[ +.B \-d +] +.IR from +.IR to + +.SH DESCRIPTION +.B scramble +is used to rearrange the contents of an executable in order for it +to be readable by the SEGA Dreamcast game console when using CDs. +This circumvents the encryption measures by SEGA to disallow homebrew. +.SH OPTIONS +.TP +.BI -d +Reverse the process, i.e. descramble. + +.SH EXAMPLES + +.EX +.B + scramble executable.elf executable_scrambled.elf +.EE + +.EX +.B + scramble -d executable_scrambled.elf executable.elf +.EE + +.SH AUTHOR +This manual page was initially written by Stefan Galowicz <bo...@pr...>, +for the KOS project. +.TP +The program has been initially written by Marcus Comstedt and was obtained from +his site (http://mc.pp.se/dc/). +.SH SEE ALSO hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: bogglez <bo...@us...> - 2017-03-09 18:40:44
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 821bcbd45838c172837ab1e1ce01da8109f9d0a3 (commit) from e1425c7a621053c0af826599bfb90e85e0d78af9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 821bcbd45838c172837ab1e1ce01da8109f9d0a3 Author: bogglez <bo...@pr...> Date: Thu Mar 9 19:40:21 2017 +0100 Added myself to AUTHORS, updated some dates ----------------------------------------------------------------------- Summary of changes: AUTHORS | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 9b44d09..3101f38 100644 --- a/AUTHORS +++ b/AUTHORS @@ -22,7 +22,7 @@ please see the README.KOS file in the doc directory. Contributors list (under the normal KOS license): ------------------------------------------------- Dan Potter: 1997, 2000, 2001, 2002, 2003, 2004 -Lawrence Sebald: 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016 +Lawrence Sebald: 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017 Sam Steele: 2004 Gil Megidish: 2002 Florian Schulze: 2002 @@ -38,8 +38,9 @@ Vincent Penne: 2004 Roger Cattermole: 2002 Paul Boese: 2002 Brian Paul: 1999, 2000, 2001 -Josh Pearson: 2013, 2014 +Josh Pearson: 2013, 2014, 2015, 2016 Joe Fenton: 2016 +Stefan Galowicz: 2016, 2017 Files with Specific licenses: ----------------------------- hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: bogglez <bo...@us...> - 2017-03-09 18:33:54
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via e1425c7a621053c0af826599bfb90e85e0d78af9 (commit) from 96cfa4a954205e87519f502222f0ae95192c5521 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e1425c7a621053c0af826599bfb90e85e0d78af9 Author: bogglez <bo...@pr...> Date: Thu Mar 9 19:26:35 2017 +0100 genromfs: check readlink return value ----------------------------------------------------------------------- Summary of changes: utils/genromfs/genromfs.c | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/utils/genromfs/genromfs.c b/utils/genromfs/genromfs.c index 5cfda66..702c9d3 100644 --- a/utils/genromfs/genromfs.c +++ b/utils/genromfs/genromfs.c @@ -320,7 +320,7 @@ void dumpri(struct romfh *ri, struct filenode *n, FILE *f) { #endif } -void dumpnode(struct filenode *node, FILE *f) { +int dumpnode(struct filenode *node, FILE *f) { struct romfh ri; struct filenode *p; @@ -362,7 +362,9 @@ void dumpnode(struct filenode *node, FILE *f) { ri.nextfh |= htonl(ROMFH_LNK); dumpri(&ri, node, f); memset(bigbuf, 0, sizeof(bigbuf)); - readlink(node->realname, bigbuf, node->size); + if(readlink(node->realname, bigbuf, node->size) < 0) { + return 1; + } dumpdataa(bigbuf, node->size, f); } else if(S_ISREG(node->modes)) { @@ -424,12 +426,16 @@ void dumpnode(struct filenode *node, FILE *f) { p = node->dirlist.head; while(p->next) { - dumpnode(p, f); + if(dumpnode(p, f)) { + return 1; + } p = p->next; } + + return 0; } -void dumpall(struct filenode *node, int lastoff, FILE *f) { +int dumpall(struct filenode *node, int lastoff, FILE *f) { struct romfh ri; struct filenode *p; @@ -441,13 +447,17 @@ void dumpall(struct filenode *node, int lastoff, FILE *f) { p = node->dirlist.head; while(p->next) { - dumpnode(p, f); + if(dumpnode(p, f)) { + return 1; + } p = p->next; } /* Align the whole bunch to ROMBSIZE boundary */ if(lastoff & 1023) dumpzero(1024 - (lastoff & 1023), f); + + return 0; } /* Node manipulating functions */ @@ -634,7 +644,9 @@ int processdir(int level, const char *base, const char *dirname, struct stat *sb /* this is a link to follow at build time */ n->name = n->name + 1; /* strip off the leading @ */ memset(bigbuf, 0, sizeof(bigbuf)); - readlink(n->realname, bigbuf, sizeof(bigbuf)); + if(readlink(n->realname, bigbuf, sizeof(bigbuf))) { + return -1; + } n->realname = strdup(bigbuf); if(lstat(n->realname, sb)) { @@ -735,6 +747,9 @@ int processdir(int level, const char *base, const char *dirname, struct stat *sb curroffset = processdir(level + 1, n->realname, dp->d_name, sb, n, root, curroffset); } + + if(curroffset < 0) + return -1; } } @@ -876,11 +891,18 @@ int main(int argc, char *argv[]) { root = newnode(dir, volname, 0); root->parent = root; lastoff = processdir(1, dir, dir, &sb, root, root, spaceneeded(root)); + if(lastoff < 0) { + fprintf(stderr, "Error while processing directory.\n"); + return 1; + } if(verbose) shownode(0, root, stderr); - dumpall(root, lastoff, f); + if(dumpall(root, lastoff, f)) { + fprintf(stderr, "Error while dumping!\n"); + return 1; + } - exit(0); + return ret; } hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2017-03-02 15:16:23
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 96cfa4a954205e87519f502222f0ae95192c5521 (commit) via 8224404f907a2d351784cf06ae6ab02bfac6cbc1 (commit) via 7a7d29ffee2fedd09855c297b73d7e5df9c552e6 (commit) from 630e071079cfcc7be31de3fbe5963ef43b11e128 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 96cfa4a954205e87519f502222f0ae95192c5521 Author: Lawrence Sebald <ljs...@us...> Date: Thu Mar 2 10:15:52 2017 -0500 Make fs_ioctl have the "correct" prototype for the standard UNIXy ioctl(). commit 8224404f907a2d351784cf06ae6ab02bfac6cbc1 Author: Lawrence Sebald <ljs...@us...> Date: Thu Mar 2 10:15:07 2017 -0500 Remove iso_ioctl. This really hasn't been needed in a LONG time and made no sense anyway... commit 7a7d29ffee2fedd09855c297b73d7e5df9c552e6 Author: Lawrence Sebald <ljs...@us...> Date: Thu Mar 2 10:13:57 2017 -0500 Give deprecation errors for old sync primitive functions better warnings. ----------------------------------------------------------------------- Summary of changes: include/kos/cond.h | 5 ++--- include/kos/fs.h | 12 ++++++------ include/kos/mutex.h | 4 ++-- include/kos/recursive_lock.h | 16 ++++++++-------- include/kos/rwsem.h | 10 +++++----- include/kos/sem.h | 4 ++-- kernel/arch/dreamcast/fs/fs_iso9660.c | 14 +------------- kernel/fs/fs.c | 24 ++++++++++++++++++++---- 8 files changed, 46 insertions(+), 43 deletions(-) diff --git a/include/kos/cond.h b/include/kos/cond.h index 3cfce10..0b4c1cb 100644 --- a/include/kos/cond.h +++ b/include/kos/cond.h @@ -44,7 +44,7 @@ #ifndef __KOS_COND_H #define __KOS_COND_H -#include <sys/cdefs.h> +#include <kos/cdefs.h> __BEGIN_DECLS #include <arch/types.h> @@ -80,7 +80,7 @@ typedef struct condvar { \par Error Conditions: \em ENOMEM - out of memory */ -condvar_t *cond_create() __attribute__((deprecated)); +condvar_t *cond_create() __depr("Use cond_init or COND_INTIALIZER."); /** \brief Initialize a condition variable. @@ -184,4 +184,3 @@ int cond_broadcast(condvar_t *cv); __END_DECLS #endif /* __KOS_COND_H */ - diff --git a/include/kos/fs.h b/include/kos/fs.h index e617472..a2695f5 100644 --- a/include/kos/fs.h +++ b/include/kos/fs.h @@ -129,7 +129,7 @@ typedef struct vfs_handler { dirent_t *(*readdir)(void *hnd); /** \brief Execute a device-specific call on a previously opened file */ - int (*ioctl)(void *hnd, void *data, size_t size); + int (*ioctl)(void *hnd, int cmd, va_list ap); /** \brief Rename/move a file on the given VFS */ int (*rename)(struct vfs_handler *vfs, const char *fn1, const char *fn2); @@ -373,12 +373,12 @@ dirent_t *fs_readdir(file_t hnd); are not documented here. Each filesystem may define any commands that are specific to it with its implementation of this function. - \param hnd The file descriptor to operate on. - \param data The command to send. - \param size The size of the command, in bytes. - \return -1 on failure. + \param fd The file descriptor to use. + \param cmd The command to run. + \param ... Arguments for the command specified. + \return -1 on error. */ -int fs_ioctl(file_t hnd, void *data, size_t size); +int fs_ioctl(file_t hnd, int cmd, ...); /** \brief Rename the specified file to the given filename. diff --git a/include/kos/mutex.h b/include/kos/mutex.h index 1aba923..0807084 100644 --- a/include/kos/mutex.h +++ b/include/kos/mutex.h @@ -54,7 +54,7 @@ #ifndef __KOS_MUTEX_H #define __KOS_MUTEX_H -#include <sys/cdefs.h> +#include <kos/cdefs.h> __BEGIN_DECLS @@ -110,7 +110,7 @@ typedef struct kos_mutex { be used in any future code, and may be removed in the future. You should instead use mutex_init(). */ -mutex_t *mutex_create() __attribute__((deprecated)); +mutex_t *mutex_create() __depr("Use mutex_init or an initializer."); /** \brief Initialize a new mutex. diff --git a/include/kos/recursive_lock.h b/include/kos/recursive_lock.h index ed4b23a..f7aa8f7 100644 --- a/include/kos/recursive_lock.h +++ b/include/kos/recursive_lock.h @@ -23,7 +23,7 @@ #ifndef __KOS_RECURSIVE_LOCK_H #define __KOS_RECURSIVE_LOCK_H -#include <sys/cdefs.h> +#include <kos/cdefs.h> __BEGIN_DECLS @@ -45,7 +45,7 @@ typedef mutex_t recursive_lock_t; \return The created lock, or NULL on failure (errno will be set to ENOMEM to indicate that the system appears to be out of memory). */ -recursive_lock_t *rlock_create() __attribute__((deprecated)); +recursive_lock_t *rlock_create() __depr("Use mutexes instead."); /** \brief Destroy a recursive lock. @@ -54,7 +54,7 @@ recursive_lock_t *rlock_create() __attribute__((deprecated)); \param l The recursive lock to destroy. It must be unlocked. */ -void rlock_destroy(recursive_lock_t *l) __attribute__((deprecated)); +void rlock_destroy(recursive_lock_t *l) __depr("Use mutexes instead."); /** \brief Lock a recursive lock. @@ -68,7 +68,7 @@ void rlock_destroy(recursive_lock_t *l) __attribute__((deprecated)); \sa rlock_trylock \sa rlock_lock_timed */ -int rlock_lock(recursive_lock_t *l) __attribute__((deprecated)); +int rlock_lock(recursive_lock_t *l) __depr("Use mutexes instead."); /** \brief Lock a recursive lock (with a timeout). @@ -87,7 +87,7 @@ int rlock_lock(recursive_lock_t *l) __attribute__((deprecated)); \sa rlock_lock_timed */ int rlock_lock_timed(recursive_lock_t *l, int timeout) - __attribute__((deprecated)); + __depr("Use mutexes instead."); /** \brief Unlock a recursive lock. @@ -98,7 +98,7 @@ int rlock_lock_timed(recursive_lock_t *l, int timeout) by the calling thread. \retval 0 On success. */ -int rlock_unlock(recursive_lock_t *l) __attribute__((deprecated)); +int rlock_unlock(recursive_lock_t *l) __depr("Use mutexes instead."); /** \brief Attempt to lock a recursive lock without blocking. @@ -113,7 +113,7 @@ int rlock_unlock(recursive_lock_t *l) __attribute__((deprecated)); \sa rlock_lock \sa rlock_lock_timed */ -int rlock_trylock(recursive_lock_t *l) __attribute__((deprecated)); +int rlock_trylock(recursive_lock_t *l) __depr("Use mutexes instead."); /** \brief Check if a recursive lock is currently held by any thread. @@ -125,7 +125,7 @@ int rlock_trylock(recursive_lock_t *l) __attribute__((deprecated)); \retval TRUE If the lock is held by any thread. \retval FALSE If the lock is not currently held by any thread. */ -int rlock_is_locked(recursive_lock_t *l) __attribute__((deprecated)); +int rlock_is_locked(recursive_lock_t *l) __depr("Use mutexes instead."); __END_DECLS diff --git a/include/kos/rwsem.h b/include/kos/rwsem.h index cb486bb..b01621b 100644 --- a/include/kos/rwsem.h +++ b/include/kos/rwsem.h @@ -25,7 +25,7 @@ #ifndef __KOS_RWSEM_H #define __KOS_RWSEM_H -#include <sys/cdefs.h> +#include <kos/cdefs.h> __BEGIN_DECLS @@ -70,7 +70,7 @@ typedef struct rw_semaphore { \par Error Conditions: \em ENOMEM - out of memory */ -rw_semaphore_t *rwsem_create() __attribute__((deprecated)); +rw_semaphore_t *rwsem_create() __depr("Use rwsem_init or RWSEM_INITIALIZER."); /** \brief Initialize a reader/writer semaphore. @@ -95,7 +95,7 @@ int rwsem_init(rw_semaphore_t *s); int rwsem_destroy(rw_semaphore_t *s); /** \brief Lock a reader/writer semaphore for reading (with a timeout). - + This function attempts to lock the r/w semaphore for reading. If the semaphore is locked for writing, this function will block until it is possible to obtain the lock for reading or the timeout expires. This @@ -132,7 +132,7 @@ int rwsem_read_lock_timed(rw_semaphore_t *s, int timeout); int rwsem_read_lock(rw_semaphore_t *s); /** \brief Lock a reader/writer semaphore for writing (with a timeout). - + This function attempts to lock the r/w semaphore for writing. If the semaphore is locked for reading or writing, this function will block until it is possible to obtain the lock for writing or the timeout expires. This @@ -191,7 +191,7 @@ int rwsem_read_unlock(rw_semaphore_t *s); \retval -1 On error, errno will be set as appropriate. \par Error Conditions: - \em EPERM - the write lock is not currently held by the calling + \em EPERM - the write lock is not currently held by the calling thread \n \em EINVAL - the semaphore is not initialized */ diff --git a/include/kos/sem.h b/include/kos/sem.h index 249d4c2..f634103 100644 --- a/include/kos/sem.h +++ b/include/kos/sem.h @@ -22,7 +22,7 @@ #ifndef __KOS_SEM_H #define __KOS_SEM_H -#include <sys/cdefs.h> +#include <kos/cdefs.h> __BEGIN_DECLS @@ -59,7 +59,7 @@ typedef struct semaphore { \em ENOMEM - out of memory \n \em EINVAL - the semaphore's value is invalid (less than 0) */ -semaphore_t *sem_create(int value) __attribute__((deprecated)); +semaphore_t *sem_create(int value) __depr("Use sem_init or SEM_INITAILZER."); /** \brief Initialize a semaphore for use. diff --git a/kernel/arch/dreamcast/fs/fs_iso9660.c b/kernel/arch/dreamcast/fs/fs_iso9660.c index 9f2693b..8cde499 100644 --- a/kernel/arch/dreamcast/fs/fs_iso9660.c +++ b/kernel/arch/dreamcast/fs/fs_iso9660.c @@ -945,18 +945,6 @@ static void iso_vblank(uint32 evt) { } } -/* There's only one ioctl at the moment (re-initialize caches) but you should - always clear data and size. */ -static int iso_ioctl(void * hnd, void *data, size_t size) { - (void)hnd; - (void)data; - (void)size; - - iso_reset(); - - return 0; -} - static int iso_fcntl(void *h, int cmd, va_list ap) { file_t fd = (file_t)h; int rv = -1; @@ -1042,7 +1030,7 @@ static vfs_handler_t vh = { iso_tell, iso_total, iso_readdir, - iso_ioctl, + NULL, NULL, NULL, NULL, diff --git a/kernel/fs/fs.c b/kernel/fs/fs.c index 02683ea..2b3e29b 100644 --- a/kernel/fs/fs.c +++ b/kernel/fs/fs.c @@ -526,17 +526,33 @@ dirent_t *fs_readdir(file_t fd) { return h->handler->readdir(h->hnd); } -int fs_ioctl(file_t fd, void *data, size_t size) { +int fs_vioctl(file_t fd, int cmd, va_list ap) { fs_hnd_t *h = fs_map_hnd(fd); + int rv; - if(h == NULL) return -1; + if(!h) { + errno = EBADF; + return -1; + } - if(h->handler == NULL || h->handler->ioctl == NULL) { + if(!h->handler || !h->handler->ioctl) { errno = EINVAL; return -1; } - return h->handler->ioctl(h->hnd, data, size); + rv = h->handler->ioctl(h->hnd, cmd, ap); + + return rv; +} + +int fs_ioctl(file_t fd, int cmd, ...) { + va_list ap; + int rv; + + va_start(ap, cmd); + rv = fs_vioctl(fd, cmd, ap); + va_end(ap); + return rv; } static vfs_handler_t * fs_verify_handler(const char * fn) { hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2017-03-02 14:49:12
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 630e071079cfcc7be31de3fbe5963ef43b11e128 (commit) from 2680f63cf63410b14683923df91a14fef7c0b352 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 630e071079cfcc7be31de3fbe5963ef43b11e128 Author: Lawrence Sebald <ljs...@us...> Date: Thu Mar 2 09:48:50 2017 -0500 Remove the old (non-updated) LaTeX manuals. ----------------------------------------------------------------------- Summary of changes: doc/manual/Makefile | 36 - doc/manual/kgl.lyx | 3629 --------------------------------------------------- doc/manual/kos.tex | 2391 --------------------------------- 3 files changed, 6056 deletions(-) delete mode 100644 doc/manual/Makefile delete mode 100644 doc/manual/kgl.lyx delete mode 100644 doc/manual/kos.tex diff --git a/doc/manual/Makefile b/doc/manual/Makefile deleted file mode 100644 index c235ded..0000000 --- a/doc/manual/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# Small makefile to generate the output formats -# Probably requires Linux, BSD, or a well-stocked Cygwin - -all: archives clean - -kgl: - -rm -rf kgl_html - lyx kgl.lyx -e latex - sed -e '4d' < kgl.tex > kgl2.tex - mv kgl2.tex kgl.tex - mkdir kgl_html - latex2html -split 4 -local_icons -white -dir kgl_html kgl.tex - -rm -f kgl_html/images.* kgl_html/*.pl kgl_html/WARNINGS kgl_html/kgl.html - -rm -f kos.pdf - latex kgl.tex - latex kgl.tex - pdflatex kgl.tex - -rm -f kgl.tex kgl.toc kgl.dvi - -kos: - -rm -rf kos_html - mkdir kos_html - latex2html -split 4 -local_icons -white -dir kos_html kos.tex - -rm -f kos_html/images.* kos_html/*.pl kos_html/WARNINGS kos_html/kos.html - -rm -f kos.pdf - latex kos.tex - latex kos.tex - pdflatex kos.tex - -rm -f kos.toc kos.dvi - -archives: kgl kos - zip -r kos_html.zip kos_html/ - zip -r kgl_html.zip kgl_html/ - -clean: - -rm -rf kos_html kgl_html *.aux *.log *.toc kgl.tex diff --git a/doc/manual/kgl.lyx b/doc/manual/kgl.lyx deleted file mode 100644 index 19922fa..0000000 --- a/doc/manual/kgl.lyx +++ /dev/null @@ -1,3629 +0,0 @@ -#LyX 1.1 created this file. For more info see http://www.lyx.org/ -\lyxformat 218 -\textclass report -\language english -\inputencoding latin1 -\fontscheme default -\graphics default -\float_placement h!p!b -\paperfontsize default -\spacing onehalf -\papersize Default -\paperpackage a4 -\use_geometry 1 -\use_amsmath 0 -\paperorientation portrait -\leftmargin 0.5in -\topmargin 0.5in -\rightmargin 0.5in -\bottommargin 0.5in -\secnumdepth 2 -\tocdepth 2 -\paragraph_separation indent -\defskip medskip -\quotes_language swedish -\quotes_times 2 -\papercolumns 1 -\papersides 1 -\paperpagestyle default - -\layout Title - -Cryptic Allusion KallistiGL / Programmer's Manual -\layout Author - - -\family roman -\series medium -\shape up -\emph off -\bar no -\noun off -\latex no_latex -\color none -© -\family default -\series default -\shape default -\emph default -\bar default -\noun default -\latex default -\color default -2002 Paul Boese -\layout Standard - - -\begin_inset LatexCommand \tableofcontents{} - -\end_inset - - -\layout Chapter* - -Legal -\layout Standard - - -\begin_inset Quotes eld -\end_inset - -Sega -\begin_inset Quotes erd -\end_inset - - and -\begin_inset Quotes eld -\end_inset - -Dreamcast -\begin_inset Quotes erd -\end_inset - - are registered trademarks of Sega Enterprises, Ltd. - This package has no association with Sega or any of its affiliates, besides - working on their hardware. -\layout Standard - - -\begin_inset Quotes eld -\end_inset - -Gameboy Advance -\begin_inset Quotes erd -\end_inset - - is a registered trademark of Nintendo, Inc. - This package has no association with Nintendo or any of its affiliates, - besides working on some of their hardware. -\layout Standard - - -\begin_inset Quotes eld -\end_inset - -OpenGL -\begin_inset Quotes erd -\end_inset - - is a registered trademark owned by Silicon Graphics, Inc. - This package has no association with Silicon Graphics or any of its affiliates. - This product is based on the published OpenGL -\family roman -\series medium -\shape up -\emph off -\bar no -\noun off -\latex no_latex -\color none -® -\family default -\series default -\shape default -\emph default -\bar default -\noun default -\latex default -\color default -\SpecialChar ~ -API, but is not an implementation which is certified or licensed by Silicon - Graphics, Inc. - under the OpenGL -\family roman -\series medium -\shape up -\emph off -\bar no -\noun off -\latex no_latex -\color none -® -\family default -\series default -\shape default -\emph default -\bar default -\noun default -\latex default -\color default -\SpecialChar ~ -API. -\layout Standard - -All other trademarks are owned by their respective trademark holders. -\layout Standard - -KallistiOS -\family roman -\series medium -\shape up -\emph off -\bar no -\noun off -\latex no_latex -\color none -© -\family default -\series default -\shape default -\emph default -\bar default -\noun default -\latex default -\color default -2000-2002 Dan Potter. - Other portions -\family roman -\series medium -\shape up -\emph off -\bar no -\noun off -\latex no_latex -\color none -© -\family default -\series default -\shape default -\emph default -\bar default -\noun default -\latex default -\color default - their individual authors; please contact the authors for information on - using and/or distriburing their code. -\layout Standard - -KallistiGL -\family roman -\series medium -\shape up -\emph off -\bar no -\noun off -\latex no_latex -\color none -© -\family default -\series default -\shape default -\emph default -\bar default -\noun default -\latex default -\color default -2000-2002 Dan Potter, Benoit Miller, and others. - Other portions -\family roman -\series medium -\shape up -\emph off -\bar no -\noun off -\latex no_latex -\color none -© -\family default -\series default -\shape default -\emph default -\bar default -\noun default -\latex default -\color default - their individual authors; please contact the authors for information on - using and/or distriburing their code. -\layout Standard - -Redistribution and use in source and binary forms, with or without modification, - are permitted provided that the following conditions are met: -\layout Enumerate - -Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -\layout Enumerate - -Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -\layout Enumerate - -Neither the name of Cryptic Allusion nor the names of its contributors may - be used to endorse or promote products derived from this software without - specific prior written permission. -\layout Standard - -THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. - IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -\layout Chapter - -Overview -\layout Standard - -The KallistiGL (KGL) name is not intended to infringe on the OpenGL -\family roman -\series medium -\shape up -\emph off -\bar no -\noun off -\latex no_latex -\color none -® -\family default -\series default -\shape default -\emph default -\bar default -\noun default -\latex default -\color default -\SpecialChar ~ -trademark owned by Silicon Graphics Inc. - It stands for KallistiOS Graphics Library. - Please note the following quote (in case you didn't read the legal stuff) - from the trademark.pdf published at the SGI website -\newline - -\begin_inset LatexCommand \url{http://www.sgi.com/software/opengl/license.html} - -\end_inset - - -\layout Quote - - -\begin_inset Quotes eld -\end_inset - -This product is based on the published OpenGL -\family roman -\series medium -\shape up -\emph off -\bar no -\noun off -\latex no_latex -\color none -® -\family default -\series default -\shape default -\emph default -\bar default -\noun default -\latex default -\color default -\SpecialChar ~ -API, but is not an implementation which is certified or licensed by Silicon - Graphics, Inc. - under the OpenGL -\family roman -\series medium -\shape up -\emph off -\bar no -\noun off -\latex no_latex -\color none -® -\family default -\series default -\shape default -\emph default -\bar default -\noun default -\latex default -\color default -\SpecialChar ~ -API. -\begin_inset Quotes erd -\end_inset - - -\layout Standard - -We are not making this a library that is going to be 100% OpenGL -\family roman -\series medium -\shape up -\emph off -\bar no -\noun off -\latex no_latex -\color none -® -\family default -\series default -\shape default -\emph default -\bar default -\noun default -\latex default -\color default - complient, nor are we planning get it conformance tested and licensed. - It is our goal to make a library that is fast and provides enough features - that it will be possible to port some OpenGL -\family roman -\series medium -\shape up -\emph off -\bar no -\noun off -\latex no_latex -\color none -® -\family default -\series default -\shape default -\emph default -\bar default -\noun default -\latex default -\color default - games, and also make it easier for homebrew developers to create new and - original works for the Dreamcast. - We are striving for a certain level of OpenGL -\family roman -\series medium -\shape up -\emph off -\bar no -\noun off -\latex no_latex -\color none -® -\family default -\series default -\shape default -\emph default -\bar default -\noun default -\latex default -\color default - conformance but do not intend to add features that we believe are either - incompatible with an embedded system or don't map easily to the hardware. - At the time of this writing KGL is a Dreamcast only API. -\layout Chapter - -KGL API -\layout Standard - -This is not an OpenGL -\family roman -\series medium -\shape up -\emph off -\bar no -\noun off -\latex no_latex -\color none -® -\family default -\series default -\shape default -\emph default -\bar default -\noun default -\latex default -\color default - tutorial or complete reference. - Those are available online or at a bookstore. - This section describes the KGL API currently implemented, the GL_XXX enums - supported, and any known non-conformance issues, or DC features for each - API function. - The API includes non-working stubs for some functions to ease porting. - These stubs will be clearly noted. - If you think KGL is doing something weird or wrong please refer to this - document to determine if the functions in question are supported. -\layout Standard - -Some of the glKos functions were created to support the Direct Render method - of sending polygons to the hardware. - Those functions are marker with -\begin_inset Quotes eld ...<truncated>... hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2017-01-27 21:51:30
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 2680f63cf63410b14683923df91a14fef7c0b352 (commit) from 6bc63beb72a37bd248e10a9f0392bce3fda7c18f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2680f63cf63410b14683923df91a14fef7c0b352 Author: Lawrence Sebald <ljs...@us...> Date: Fri Jan 27 16:51:01 2017 -0500 Add two attributes to kos/cdefs.h for marking things as deprecated. ----------------------------------------------------------------------- Summary of changes: include/kos/cdefs.h | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/include/kos/cdefs.h b/include/kos/cdefs.h index 36566b3..9b4259d 100644 --- a/include/kos/cdefs.h +++ b/include/kos/cdefs.h @@ -49,6 +49,19 @@ /** \brief Alias for \ref __pure. For BSD compatibility. */ #define __pure2 __pure /* ditto */ +/** \brief Mark something as deprecated. + This should be used to warn users that a function/type/etc will be removed + in a future version of KOS. */ +#define __deprecated __attribute__((deprecated)) + +/** \brief Mark something as deprecated, with an informative message. + This should be used to warn users that a function/type/etc will be removed + in a future version of KOS and to suggest an alternative that they can use + instead. + \param m A string literal that is included with the warning message + at compile time. */ +#define __depr(m) __attribute__((deprecated(m))) + /* Printf/Scanf-like declaration */ /** \brief Identify a function as accepting formatting like printf(). hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2017-01-27 21:37:04
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 6bc63beb72a37bd248e10a9f0392bce3fda7c18f (commit) from 0145c306719790fe6b45c2cce09a0e0a5aa96989 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6bc63beb72a37bd248e10a9f0392bce3fda7c18f Author: Lawrence Sebald <ljs...@us...> Date: Fri Jan 27 16:36:26 2017 -0500 Add -Wno-deprecated to the kernel's compiler flags. ----------------------------------------------------------------------- Summary of changes: Makefile | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/Makefile b/Makefile index b5dc4c4..e068a87 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ # compiling all of KOS proper. # I expect everyone to keep their code warning free. Don't make me add -Werror # here too. ;-) -KOS_CFLAGS += -Wextra +KOS_CFLAGS += -Wextra -Wno-deprecated # Add stuff to DIRS to auto-compile it with the big tree. DIRS = utils hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2017-01-26 03:07:16
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 0145c306719790fe6b45c2cce09a0e0a5aa96989 (commit) from 818465f864c98329a7f70dc4b77dcb89c2ae3ec2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0145c306719790fe6b45c2cce09a0e0a5aa96989 Author: Lawrence Sebald <ljs...@us...> Date: Wed Jan 25 22:06:27 2017 -0500 Use binary mode on fopen so these tools work on MinGW and the like. ----------------------------------------------------------------------- Summary of changes: utils/bincnv/bincnv.c | 5 ++--- utils/dcbumpgen/get_image_png.c | 7 +++---- utils/kmgenc/get_image_png.c | 3 +-- utils/rdtest/rdtest.c | 13 +------------ utils/vqenc/get_image_png.c | 3 +-- 5 files changed, 8 insertions(+), 23 deletions(-) diff --git a/utils/bincnv/bincnv.c b/utils/bincnv/bincnv.c index 1815d8b..08abee3 100644 --- a/utils/bincnv/bincnv.c +++ b/utils/bincnv/bincnv.c @@ -360,7 +360,7 @@ void main(int argc, char **argv) { void *out; int sz; - f = fopen(argv[1], "r"); + f = fopen(argv[1], "rb"); if(!f) { perror("Can't open input file"); @@ -369,8 +369,7 @@ void main(int argc, char **argv) { out = elf_load(f, 0x8c010000, &sz); - f = fopen(argv[2], "w"); + f = fopen(argv[2], "wb"); fwrite(out, sz, 1, f); fclose(f); } - diff --git a/utils/dcbumpgen/get_image_png.c b/utils/dcbumpgen/get_image_png.c index 96ed967..aec635d 100644 --- a/utils/dcbumpgen/get_image_png.c +++ b/utils/dcbumpgen/get_image_png.c @@ -6,7 +6,7 @@ Based on Jeff's png_load_texture routine, but loads into a KOS plat-independent image. */ - + #include <assert.h> #include <stdlib.h> #include <png.h> @@ -27,7 +27,7 @@ void _png_copy_texture(uint8 *buffer, uint8 *temp_tex, for(i = 0; i < h; i++) { pRow = &buffer[i*stride]; ourbuffer = &temp_tex[i*w*4]; - + if (channels == 3) { for (j=0; j<w; j++) { ourbuffer[j*4+0] = 0xff; @@ -59,7 +59,7 @@ int get_image_png(const char * filename, image_t * image) { assert( image != NULL ); - if ((infile = fopen(filename, "r")) == 0) { + if ((infile = fopen(filename, "rb")) == 0) { printf("png_to_texture: can't open %s\n", filename); return -1; } @@ -93,4 +93,3 @@ int get_image_png(const char * filename, image_t * image) { /* And we're done! */ return 0; } - diff --git a/utils/kmgenc/get_image_png.c b/utils/kmgenc/get_image_png.c index d9008e2..b9d445d 100644 --- a/utils/kmgenc/get_image_png.c +++ b/utils/kmgenc/get_image_png.c @@ -58,7 +58,7 @@ int get_image_png(const char * filename, image_t * image) { assert(image != NULL); - if((infile = fopen(filename, "r")) == 0) { + if((infile = fopen(filename, "rb")) == 0) { printf("png_to_texture: can't open %s\n", filename); return -1; } @@ -92,4 +92,3 @@ int get_image_png(const char * filename, image_t * image) { /* And we're done! */ return 0; } - diff --git a/utils/rdtest/rdtest.c b/utils/rdtest/rdtest.c index e271f53..d19afcb 100644 --- a/utils/rdtest/rdtest.c +++ b/utils/rdtest/rdtest.c @@ -461,7 +461,7 @@ void init() { FILE *f; int size; - f = fopen("romdisk2.img", "r"); + f = fopen("romdisk2.img", "rb"); if(!f) return; @@ -535,14 +535,3 @@ int main() { return 0; } - - - - - - - - - - - diff --git a/utils/vqenc/get_image_png.c b/utils/vqenc/get_image_png.c index a4ca39d..3668167 100644 --- a/utils/vqenc/get_image_png.c +++ b/utils/vqenc/get_image_png.c @@ -58,7 +58,7 @@ int get_image_png(const char * filename, image_t * image) { assert(image != NULL); - if((infile = fopen(filename, "r")) == 0) { + if((infile = fopen(filename, "rb")) == 0) { printf("png_to_texture: can't open %s\n", filename); return -1; } @@ -92,4 +92,3 @@ int get_image_png(const char * filename, image_t * image) { /* And we're done! */ return 0; } - hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2017-01-17 20:26:33
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 818465f864c98329a7f70dc4b77dcb89c2ae3ec2 (commit) from e264bad2bc37a3fad990392abdc81b4eb19fdd99 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 818465f864c98329a7f70dc4b77dcb89c2ae3ec2 Author: Lawrence Sebald <ljs...@us...> Date: Tue Jan 17 15:26:01 2017 -0500 Make dc-chain not fail if patches have already been applied (i.e, you're trying to correct a failed build). ----------------------------------------------------------------------- Summary of changes: utils/dc-chain/Makefile | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/dc-chain/Makefile b/utils/dc-chain/Makefile index f2b4633..39ba7f2 100644 --- a/utils/dc-chain/Makefile +++ b/utils/dc-chain/Makefile @@ -99,16 +99,16 @@ patch-newlib: $(newlib_patches) patch-kos: $(kos_patches) $(newlib_patches): - patch -d $(newlib_dir) -p1 < $@ + patch -N -d $(newlib_dir) -p1 < $@ $(binutils_patches): - patch -d $(binutils_dir) -p1 < $@ + patch -N -d $(binutils_dir) -p1 < $@ $(gcc_patches): - patch -d $(gcc_dir) -p1 < $@ + patch -N -d $(gcc_dir) -p1 < $@ $(kos_patches): - patch -d $(kos_root) -p1 < $@ + patch -N -d $(kos_root) -p1 < $@ # ---- }}} hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2017-01-16 05:05:52
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via e264bad2bc37a3fad990392abdc81b4eb19fdd99 (commit) from 7d7aa89ca1d10a1bef20984a6a0120e616421f9e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e264bad2bc37a3fad990392abdc81b4eb19fdd99 Author: Lawrence Sebald <ljs...@us...> Date: Mon Jan 16 00:05:08 2017 -0500 Fix typo. ----------------------------------------------------------------------- Summary of changes: include/kos/cdefs.h | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-) diff --git a/include/kos/cdefs.h b/include/kos/cdefs.h index 335947a..36566b3 100644 --- a/include/kos/cdefs.h +++ b/include/kos/cdefs.h @@ -1,7 +1,7 @@ /* KallistiOS ##version## kos/cdefs.h - Copyright (C)2002,2004 Dan Potter + Copyright (C) 2002, 2004 Dan Potter Based loosely around some stuff in BSD's sys/cdefs.h */ @@ -46,7 +46,7 @@ /** \brief Alias for \ref __noreturn. For BSD compatibility. */ #define __dead2 __noreturn /* BSD compat */ -/** \brief Alias for \ref __pure. Fore BSD compatibility. */ +/** \brief Alias for \ref __pure. For BSD compatibility. */ #define __pure2 __pure /* ditto */ /* Printf/Scanf-like declaration */ @@ -76,5 +76,3 @@ /* #if __GNUC__ == */ #endif /* __KOS_CDEFS_H */ - - hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2017-01-06 06:38:38
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 7d7aa89ca1d10a1bef20984a6a0120e616421f9e (commit) from 6543ade3756abc256d47d4bca996fec2f4c0bb5c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7d7aa89ca1d10a1bef20984a6a0120e616421f9e Author: Lawrence Sebald <ljs...@us...> Date: Fri Jan 6 01:36:46 2017 -0500 Fix compilation of C++ stuff that manages to #include <sys/uio.h>. I forgot the __END_DECLS at the end of the file, so any C++ that happened to include it would probably break if it did things like overloading functions (like, say libdcplib does). ----------------------------------------------------------------------- Summary of changes: include/sys/uio.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/include/sys/uio.h b/include/sys/uio.h index 1086559..d35417d 100644 --- a/include/sys/uio.h +++ b/include/sys/uio.h @@ -36,4 +36,6 @@ struct iovec { /** \brief Old alias for the maximum length of an iovec. */ #define UIO_MAXIOV IOV_MAX +__END_DECLS + #endif /* __SYS_UIO_H */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2017-01-05 15:16:14
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 6543ade3756abc256d47d4bca996fec2f4c0bb5c (commit) via 7e91a1f6039df73b967b376698840fcedbf781a0 (commit) from 83bee68d8d5a6e48cb3f8911c22c3af440b04096 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6543ade3756abc256d47d4bca996fec2f4c0bb5c Author: Lawrence Sebald <ljs...@us...> Date: Thu Jan 5 10:15:36 2017 -0500 Provide a compatibility typedef in case anyone was using the old iovec_t type. commit 7e91a1f6039df73b967b376698840fcedbf781a0 Author: Lawrence Sebald <ljs...@us...> Date: Thu Jan 5 10:15:03 2017 -0500 Oops, forgot these two with the <sys/uio.h> commit... Sorry about that. ----------------------------------------------------------------------- Summary of changes: include/kos/iovec.h | 3 +++ kernel/arch/dreamcast/include/arch/mmu.h | 6 +++--- kernel/arch/dreamcast/kernel/mmu.c | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/kos/iovec.h b/include/kos/iovec.h index b835b38..d8c9e55 100644 --- a/include/kos/iovec.h +++ b/include/kos/iovec.h @@ -16,4 +16,7 @@ #include <sys/uio.h> +/** \brief Compatibility typedef for old code. */ +typedef struct iovec iovec_t; + #endif /* __KOS_IOVEC_H */ diff --git a/kernel/arch/dreamcast/include/arch/mmu.h b/kernel/arch/dreamcast/include/arch/mmu.h index 252f22e..1aeec18 100644 --- a/kernel/arch/dreamcast/include/arch/mmu.h +++ b/kernel/arch/dreamcast/include/arch/mmu.h @@ -48,7 +48,7 @@ __BEGIN_DECLS #include <arch/types.h> -#include <kos/iovec.h> +#include <sys/uio.h> /* Since the software has to handle TLB misses on the SH-4, we have freedom to use any page table format we want (and thus save space), but we must @@ -286,8 +286,8 @@ int mmu_copyin(mmucontext_t *context, uint32 srcaddr, uint32 srccnt, \param iov2 The scatter/gather array to copy to. \param iovcnt2 The number of entries in iov2. */ -int mmu_copyv(mmucontext_t *context1, iovec_t *iov1, int iovcnt1, - mmucontext_t *context2, iovec_t *iov2, int iovcnt2); +int mmu_copyv(mmucontext_t *context1, struct iovec *iov1, int iovcnt1, + mmucontext_t *context2, struct iovec *iov2, int iovcnt2); /** \brief MMU mapping handler. diff --git a/kernel/arch/dreamcast/kernel/mmu.c b/kernel/arch/dreamcast/kernel/mmu.c index 425ce25..2d679b3 100644 --- a/kernel/arch/dreamcast/kernel/mmu.c +++ b/kernel/arch/dreamcast/kernel/mmu.c @@ -403,8 +403,8 @@ int mmu_copyin(mmucontext_t *context, uint32 srcaddr, uint32 srccnt, void *buffe This routine is pretty nasty.. this is completely platform generic but should probably be replaced by a nice assembly routine for each platform as appropriate. */ -int mmu_copyv(mmucontext_t *context1, iovec_t *iov1, int iovcnt1, - mmucontext_t *context2, iovec_t *iov2, int iovcnt2) { +int mmu_copyv(mmucontext_t *context1, struct iovec *iov1, int iovcnt1, + mmucontext_t *context2, struct iovec *iov2, int iovcnt2) { mmupage_t *srcpage, *dstpage; int srciov, dstiov; uint32 srccnt, dstcnt; hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2017-01-02 21:19:51
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 83bee68d8d5a6e48cb3f8911c22c3af440b04096 (commit) from a0c96f374d6afe0afd1487d1cf88b6b8c138e310 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 83bee68d8d5a6e48cb3f8911c22c3af440b04096 Author: Lawrence Sebald <ljs...@us...> Date: Mon Jan 2 16:18:53 2017 -0500 Fix header comment for socket.h. We've had IPv6 support for a while, so we probably shouldn't say we don't. ----------------------------------------------------------------------- Summary of changes: include/sys/socket.h | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/sys/socket.h b/include/sys/socket.h index fba088f..e1f642b 100644 --- a/include/sys/socket.h +++ b/include/sys/socket.h @@ -9,11 +9,10 @@ \brief Main sockets header. This file contains the standard definitions (as directed by the POSIX 2008 - standard) for socket-related functionality in the AF_INET address family. - This does not include anything related to AF_INET6 (as IPv6 is not currently - implemented in KOS) nor UNIX domain sockets, and is not guaranteed to have - everything that one might have in a fully-standard compliant implementation - of the POSIX standard. + spec) for socket-related functionality in the AF_INET and AF_INET6 address + families. This does not include anything related to UNIX domain sockets + and is not guaranteed to have everything that one might have in a + fully-standards compliant implementation of the POSIX spec. \author Lawrence Sebald */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2017-01-02 20:51:03
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via a0c96f374d6afe0afd1487d1cf88b6b8c138e310 (commit) via f61025745b30a1d5cc6f7b38e6ef8863b493dee6 (commit) from ca3a51cbc21df2306c2df3f03ad111c793b6b110 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a0c96f374d6afe0afd1487d1cf88b6b8c138e310 Author: Lawrence Sebald <ljs...@us...> Date: Mon Jan 2 15:50:08 2017 -0500 Include <sys/uio.h> from <sys/socket.h>. Per POSIX: "The <sys/socket.h> header shall define the iovec structure as described in <sys/uio.h>." commit f61025745b30a1d5cc6f7b38e6ef8863b493dee6 Author: Lawrence Sebald <ljs...@us...> Date: Mon Jan 2 15:16:20 2017 -0500 Move <kos/iovec.h> to <sys/uio.h>, as specified by POSIX. ----------------------------------------------------------------------- Summary of changes: include/kos/iovec.h | 24 ++++-------------------- include/sys/_types.h | 5 +++++ include/sys/socket.h | 3 ++- include/sys/uio.h | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 21 deletions(-) create mode 100644 include/sys/uio.h diff --git a/include/kos/iovec.h b/include/kos/iovec.h index cd0b54b..b835b38 100644 --- a/include/kos/iovec.h +++ b/include/kos/iovec.h @@ -1,35 +1,19 @@ /* KallistiOS ##version## kos/iovec.h - Copyright (C)2001 Dan Potter + Copyright (C) 2001 Dan Potter */ /** \file kos/iovec.h - \brief Scatter/Gather arrays. + \brief Deprecated header file for I/O scatter/gather arrays. - This file contains the definition of a scatter/gather array. - - \author Dan Potter + See <sys/uio.h> for what used to be here. */ #ifndef __KOS_IOVEC_H #define __KOS_IOVEC_H -#include <sys/cdefs.h> -__BEGIN_DECLS - -#include <stddef.h> - -/** \brief Scatter/Gather array. - \headerfile kos/iovec.h -*/ -typedef struct iovec { - char *iov_base; /**< \brief Base address */ - size_t iov_len; /**< \brief Length */ -} iovec_t; - -__END_DECLS +#include <sys/uio.h> #endif /* __KOS_IOVEC_H */ - diff --git a/include/sys/_types.h b/include/sys/_types.h index db252d9..69cb8d0 100644 --- a/include/sys/_types.h +++ b/include/sys/_types.h @@ -122,6 +122,11 @@ typedef void *_iconv_t; #define AT_REMOVEDIR 8 #endif +#ifndef IOV_MAX +/** \brief Maximum length of an iovec, in elements. */ +#define IOV_MAX 1024 +#endif + // And this is for old KOS source compatability. #include <arch/types.h> diff --git a/include/sys/socket.h b/include/sys/socket.h index 04fdfa7..fba088f 100644 --- a/include/sys/socket.h +++ b/include/sys/socket.h @@ -1,7 +1,7 @@ /* KallistiOS ##version## sys/socket.h - Copyright (C)2006, 2010, 2012 Lawrence Sebald + Copyright (C) 2006, 2010, 2012, 2017 Lawrence Sebald */ @@ -23,6 +23,7 @@ #include <sys/cdefs.h> #include <sys/types.h> +#include <sys/uio.h> __BEGIN_DECLS diff --git a/include/sys/uio.h b/include/sys/uio.h new file mode 100644 index 0000000..1086559 --- /dev/null +++ b/include/sys/uio.h @@ -0,0 +1,39 @@ +/* KallistiOS ##version## + + sys/uio.h + Copyright (C) 2017 Lawrence Sebald + +*/ + +/** \file sys/uio.h + \brief Header for vector I/O. + + This file contains definitions for vector I/O operations, as specified by + the POSIX 2008 specification. Full vector-based I/O is not supported for + file operations, but the stuff in here is still useful elsewhere. + + \author Lawrence Sebald +*/ + +#ifndef __SYS_UIO_H +#define __SYS_UIO_H + +#include <sys/cdefs.h> +#include <sys/types.h> + +__BEGIN_DECLS + +/** \brief I/O vector structure + \headerfile sys/iovec.h +*/ +struct iovec { + /** \brief Base address of memory for I/O. */ + void * iov_base; + /** \brief Size of memory pointed to by iov_base. */ + size_t iov_len; +}; + +/** \brief Old alias for the maximum length of an iovec. */ +#define UIO_MAXIOV IOV_MAX + +#endif /* __SYS_UIO_H */ hooks/post-receive -- A pseudo Operating System for the Dreamcast. |
From: Lawrence S. <ljs...@us...> - 2017-01-02 19:13:23
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via ca3a51cbc21df2306c2df3f03ad111c793b6b110 (commit) from 6834715e1da628927db00c8e53e8b6e02366a214 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ca3a51cbc21df2306c2df3f03ad111c793b6b110 Author: Lawrence Sebald <ljs...@us...> Date: Mon Jan 2 14:12:51 2017 -0500 Keeping up the theme of part of the last commit, fixing the kos-ports_clean target and adding a kos-ports_distclean one. ----------------------------------------------------------------------- Summary of changes: Makefile | 7 +++++-- 1 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 20d53c7..b5dc4c4 100644 --- a/Makefile +++ b/Makefile @@ -34,10 +34,13 @@ distclean: clean -rm -f addons/lib/$(KOS_ARCH)/* kos-ports_all: - ../kos-ports/utils/build-all.sh + $(KOS_PORTS)/utils/build-all.sh kos-ports_clean: - $(KOS_MAKE) -C ../kos-ports clean KOS_BASE=$(CURDIR) + $(KOS_PORTS)/utils/clean-all.sh + +kos-ports_distclean: kos-ports_clean + $(KOS_PORTS)/utils/uninstall-all.sh all_auto_kos_base: $(KOS_MAKE) all KOS_BASE=$(CURDIR) hooks/post-receive -- A pseudo Operating System for the Dreamcast. |