Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Vincent Wei
mg-tools
Commits
151b9161
Commit
151b9161
authored
Oct 24, 2019
by
Vincent Wei
Browse files
cleanup
parent
b545bdd0
Changes
8
Hide whitespace changes
Inline
Side-by-side
mgcfg-trans/bin/ubuntu10.04/mgcfg-trans
deleted
100755 → 0
View file @
b545bdd0
File deleted
mgcfg-trans/bin/windowsxp/mgcfg_trans.exe
deleted
100644 → 0
View file @
b545bdd0
File deleted
res2c/Makefile.am
View file @
151b9161
bin_PROGRAMS
=
res2c
res2c_SOURCES
=
res2c.cc resource.c resource.h
res2c_SOURCES
=
res2c.cc resource.c resource.h
mmap-win.c mmap-win.h
res2c/mmap-win.c
View file @
151b9161
#ifdef WIN32
#include <windows.h>
void
*
win_mmap
(
const
char
*
file
)
{
HANDLE
obj
;
HANDLE
hFile
;
int
fileSize
;
void
*
data
=
NULL
;
hFile
=
CreateFile
(
file
,
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
hFile
==
INVALID_HANDLE_VALUE
){
return
NULL
;
}
fileSize
=
GetFileSize
(
hFile
,
NULL
);
obj
=
CreateFileMapping
(
hFile
,
NULL
,
PAGE_READWRITE
,
0
,
fileSize
,
NULL
);
GetLastError
();
if
(
obj
){
data
=
MapViewOfFile
(
obj
,
FILE_MAP_WRITE
,
0
,
0
,
0
);
}
CloseHandle
(
obj
);
CloseHandle
(
hFile
);
return
data
;
}
void
win_munmap
(
void
*
mem
)
{
UnmapViewOfFile
(
mem
);
}
#endif
\ No newline at end of file
///////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT NOTICE
//
// The following open source license statement does not apply to any
// entity in the Exception List published by FMSoft.
//
// For more information, please visit:
//
// https://www.fmsoft.cn/exception-list
//
//////////////////////////////////////////////////////////////////////////////
/*
** This file is part of mg-tools, a collection of programs to convert
** and maintain the resource for MiniGUI.
**
** Copyright (C) 2010 ~ 2019, Beijing FMSoft Technologies Co., Ltd.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef WIN32
#include <windows.h>
void
*
win_mmap
(
const
char
*
file
)
{
HANDLE
obj
;
HANDLE
hFile
;
int
fileSize
;
void
*
data
=
NULL
;
hFile
=
CreateFile
(
file
,
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
if
(
hFile
==
INVALID_HANDLE_VALUE
){
return
NULL
;
}
fileSize
=
GetFileSize
(
hFile
,
NULL
);
obj
=
CreateFileMapping
(
hFile
,
NULL
,
PAGE_READWRITE
,
0
,
fileSize
,
NULL
);
GetLastError
();
if
(
obj
){
data
=
MapViewOfFile
(
obj
,
FILE_MAP_WRITE
,
0
,
0
,
0
);
}
CloseHandle
(
obj
);
CloseHandle
(
hFile
);
return
data
;
}
void
win_munmap
(
void
*
mem
)
{
UnmapViewOfFile
(
mem
);
}
#endif
res2c/mmap-win.h
View file @
151b9161
#ifdef WIN32
void
*
win_mmap
(
const
char
*
file
);
void
win_munmap
(
void
*
mem
);
#endif
\ No newline at end of file
///////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT NOTICE
//
// The following open source license statement does not apply to any
// entity in the Exception List published by FMSoft.
//
// For more information, please visit:
//
// https://www.fmsoft.cn/exception-list
//
//////////////////////////////////////////////////////////////////////////////
/*
** This file is part of mg-tools, a collection of programs to convert
** and maintain the resource for MiniGUI.
**
** Copyright (C) 2010 ~ 2019, Beijing FMSoft Technologies Co., Ltd.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef WIN32
void
*
win_mmap
(
const
char
*
file
);
void
win_munmap
(
void
*
mem
);
#endif
res2c/res2c.cc
View file @
151b9161
/**
* $Id$
*
* Author: XiaoweiYan
*/
///////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT NOTICE
//
// The following open source license statement does not apply to any
// entity in the Exception List published by FMSoft.
//
// For more information, please visit:
//
// https://www.fmsoft.cn/exception-list
//
//////////////////////////////////////////////////////////////////////////////
/*
** This file is part of mg-tools, a collection of programs to convert
** and maintain the resource for MiniGUI.
**
** Copyright (C) 2010 ~ 2019, Beijing FMSoft Technologies Co., Ltd.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
...
...
res2c/resource.c
View file @
151b9161
/**
* $Id$
*
* Author: XiaoweiYan
*/
///////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT NOTICE
//
// The following open source license statement does not apply to any
// entity in the Exception List published by FMSoft.
//
// For more information, please visit:
//
// https://www.fmsoft.cn/exception-list
//
//////////////////////////////////////////////////////////////////////////////
/*
** This file is part of mg-tools, a collection of programs to convert
** and maintain the resource for MiniGUI.
**
** Copyright (C) 2010 ~ 2019, Beijing FMSoft Technologies Co., Ltd.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
...
...
@@ -38,7 +64,7 @@ struct _MAPFILELIST
typedef
struct
_RPINFO
{
PMAPFILELIST
head
;
int
ref
;
int
ref
;
void
*
data
;
long
data_size
;
}
RPINFO
;
...
...
@@ -112,7 +138,7 @@ static void del_alllist(HPACKAGE package)
while
(
head
)
{
#ifdef WIN32
win_munmap
(
head
->
data
);
win_munmap
(
head
->
data
);
#else
#if HAVE_MMAP
munmap
(
head
->
data
,
head
->
data_size
);
...
...
@@ -167,7 +193,7 @@ static int del_list(HPACKAGE package, Uint32 filename_id)
if
(
found
==
TRUE
)
{
#ifdef WIN32
win_munmap
(
list
->
data
);
win_munmap
(
list
->
data
);
#else
#if HAVE_MMAP
munmap
(
list
->
data
,
list
->
data_size
);
...
...
@@ -235,7 +261,7 @@ binary_search_iditem (Uint32 *sect_base, Uint32 res_id)
static
char
*
mmap_file
(
const
char
*
file_name
,
long
*
file_size
)
{
#ifdef WIN32
return
(
char
*
)
win_mmap
(
file_name
);
return
(
char
*
)
win_mmap
(
file_name
);
#else
FILE
*
fp
=
NULL
;
void
*
data
;
...
...
@@ -306,10 +332,10 @@ char* get_res_sectaddr (HPACKAGE hPackage, int type)
NCSRM_HEADER
*
res_head
;
NCSRM_TYPEITEM
*
type_item
;
if
(
!
hPackage
)
return
NULL
;
if
(
!
hPackage
)
return
NULL
;
res_head
=
(
NCSRM_HEADER
*
)((
PRPINFO
)
hPackage
)
->
data
;
res_head
=
(
NCSRM_HEADER
*
)((
PRPINFO
)
hPackage
)
->
data
;
type_item
=
search_type_item
(
res_head
,
type
);
...
...
@@ -441,19 +467,19 @@ HPACKAGE ncsLoadResPackageFromFile (const char* fileName)
//set ncs system renderer for default renderer
//ncsSetSystemRenderer(ncsGetString((HPACKAGE)package, NCSRM_SYSSTR_DEFRDR));
package
->
ref
=
1
;
package
->
ref
=
1
;
return
(
HPACKAGE
)
package
;
}
void
ncsUnloadResPackage
(
HPACKAGE
package
)
{
PRPINFO
prpinfo
;
PRPINFO
prpinfo
;
if
(
package
==
HPACKAGE_NULL
)
return
;
prpinfo
=
(
PRPINFO
)
package
;
if
(
!
prpinfo
||
--
prpinfo
->
ref
>
0
)
return
;
prpinfo
=
(
PRPINFO
)
package
;
if
(
!
prpinfo
||
--
prpinfo
->
ref
>
0
)
return
;
del_alllist
(
package
);
free
(
prpinfo
);
...
...
res2c/resource.h
View file @
151b9161
/**
* $Id$
*
* Author: XiaoweiYan
*/
///////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT NOTICE
//
// The following open source license statement does not apply to any
// entity in the Exception List published by FMSoft.
//
// For more information, please visit:
//
// https://www.fmsoft.cn/exception-list
//
//////////////////////////////////////////////////////////////////////////////
/*
** This file is part of mg-tools, a collection of programs to convert
** and maintain the resource for MiniGUI.
**
** Copyright (C) 2010 ~ 2019, Beijing FMSoft Technologies Co., Ltd.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _RESOUCE_H_
#define _RESOUCE_H_
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment