More work on Magic size support; "kalidescope" <sic> is underway

This commit is contained in:
Bill Kendrick 2023-04-11 22:16:45 -07:00
parent 84bfec3365
commit 7bdb19ff0f
12 changed files with 113 additions and 30 deletions

View file

@ -310,7 +310,7 @@ Magic Tool Plugin API Documentation
Note: Called once for each Magic tool your plugin claims to Note: Called once for each Magic tool your plugin claims to
contain (by your "get_tool_count()"). contain (by your "get_tool_count()").
int accepted_sizes(magic_api * api, int which) Uint8 accepted_sizes(magic_api * api, int which)
Return how many size variations the 'Magic' tool accepts. Return a Return how many size variations the 'Magic' tool accepts. Return a
'0' if the 'Magic' tool should not offer sizing options. Returning '0' if the 'Magic' tool should not offer sizing options. Returning
@ -319,7 +319,7 @@ Magic Tool Plugin API Documentation
Note: Called once for each Magic tool your plugin claims to Note: Called once for each Magic tool your plugin claims to
contain (by your "get_tool_count()"). contain (by your "get_tool_count()").
int default_size(magic_api * api, int which) Uint8 default_size(magic_api * api, int which)
Return the default size the 'Magic' tool accepts. This will be the Return the default size the 'Magic' tool accepts. This will be the
default setting for the tool the first time it is used during a default setting for the tool the first time it is used during a

View file

@ -393,7 +393,7 @@
<b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p> <b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p>
</dd> </dd>
<dt><code><b>int accepted_sizes(magic_api * api, int which)</b></code></dt> <dt><code><b>Uint8 accepted_sizes(magic_api * api, int which)</b></code></dt>
<dd> <dd>
<p> <p>
Return how many size variations the 'Magic' tool accepts. Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'. </p> Return how many size variations the 'Magic' tool accepts. Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'. </p>
@ -401,7 +401,7 @@
<b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p> <b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p>
</dd> </dd>
<dt><code><b>int default_size(magic_api * api, int which)</b></code></dt> <dt><code><b>Uint8 default_size(magic_api * api, int which)</b></code></dt>
<dd> <dd>
<p> <p>
Return the default size the 'Magic' tool accepts. This will be the default setting for the tool the first time it is used during a Tux Paint session. If Tux Paint is being invoked with the sizing option disabled, this will be the only size requested by Tux Paint. Return a number between '1' and the amount you returned in <code>accepted_sizes()</code>. </p> Return the default size the 'Magic' tool accepts. This will be the default setting for the tool the first time it is used during a Tux Paint session. If Tux Paint is being invoked with the sizing option disabled, this will be the only size requested by Tux Paint. Return a number between '1' and the amount you returned in <code>accepted_sizes()</code>. </p>

View file

@ -310,7 +310,7 @@ Magic Tool Plugin API Documentation
Note: Called once for each Magic tool your plugin claims to Note: Called once for each Magic tool your plugin claims to
contain (by your "get_tool_count()"). contain (by your "get_tool_count()").
int accepted_sizes(magic_api * api, int which) Uint8 accepted_sizes(magic_api * api, int which)
Return how many size variations the 'Magic' tool accepts. Return a Return how many size variations the 'Magic' tool accepts. Return a
'0' if the 'Magic' tool should not offer sizing options. Returning '0' if the 'Magic' tool should not offer sizing options. Returning
@ -319,7 +319,7 @@ Magic Tool Plugin API Documentation
Note: Called once for each Magic tool your plugin claims to Note: Called once for each Magic tool your plugin claims to
contain (by your "get_tool_count()"). contain (by your "get_tool_count()").
int default_size(magic_api * api, int which) Uint8 default_size(magic_api * api, int which)
Return the default size the 'Magic' tool accepts. This will be the Return the default size the 'Magic' tool accepts. This will be the
default setting for the tool the first time it is used during a default setting for the tool the first time it is used during a

View file

@ -393,7 +393,7 @@
<b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p> <b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p>
</dd> </dd>
<dt><code><b>int accepted_sizes(magic_api * api, int which)</b></code></dt> <dt><code><b>Uint8 accepted_sizes(magic_api * api, int which)</b></code></dt>
<dd> <dd>
<p> <p>
Return how many size variations the 'Magic' tool accepts. Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'. </p> Return how many size variations the 'Magic' tool accepts. Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'. </p>
@ -401,7 +401,7 @@
<b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p> <b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p>
</dd> </dd>
<dt><code><b>int default_size(magic_api * api, int which)</b></code></dt> <dt><code><b>Uint8 default_size(magic_api * api, int which)</b></code></dt>
<dd> <dd>
<p> <p>
Return the default size the 'Magic' tool accepts. This will be the default setting for the tool the first time it is used during a Tux Paint session. If Tux Paint is being invoked with the sizing option disabled, this will be the only size requested by Tux Paint. Return a number between '1' and the amount you returned in <code>accepted_sizes()</code>. </p> Return the default size the 'Magic' tool accepts. This will be the default setting for the tool the first time it is used during a Tux Paint session. If Tux Paint is being invoked with the sizing option disabled, this will be the only size requested by Tux Paint. Return a number between '1' and the amount you returned in <code>accepted_sizes()</code>. </p>

View file

@ -310,7 +310,7 @@ Magic Tool Plugin API Documentation
Note: Called once for each Magic tool your plugin claims to Note: Called once for each Magic tool your plugin claims to
contain (by your "get_tool_count()"). contain (by your "get_tool_count()").
int accepted_sizes(magic_api * api, int which) Uint8 accepted_sizes(magic_api * api, int which)
Return how many size variations the 'Magic' tool accepts. Return a Return how many size variations the 'Magic' tool accepts. Return a
'0' if the 'Magic' tool should not offer sizing options. Returning '0' if the 'Magic' tool should not offer sizing options. Returning
@ -319,7 +319,7 @@ Magic Tool Plugin API Documentation
Note: Called once for each Magic tool your plugin claims to Note: Called once for each Magic tool your plugin claims to
contain (by your "get_tool_count()"). contain (by your "get_tool_count()").
int default_size(magic_api * api, int which) Uint8 default_size(magic_api * api, int which)
Return the default size the 'Magic' tool accepts. This will be the Return the default size the 'Magic' tool accepts. This will be the
default setting for the tool the first time it is used during a default setting for the tool the first time it is used during a

View file

@ -393,7 +393,7 @@
<b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p> <b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p>
</dd> </dd>
<dt><code><b>int accepted_sizes(magic_api * api, int which)</b></code></dt> <dt><code><b>Uint8 accepted_sizes(magic_api * api, int which)</b></code></dt>
<dd> <dd>
<p> <p>
Return how many size variations the 'Magic' tool accepts. Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'. </p> Return how many size variations the 'Magic' tool accepts. Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'. </p>
@ -401,7 +401,7 @@
<b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p> <b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p>
</dd> </dd>
<dt><code><b>int default_size(magic_api * api, int which)</b></code></dt> <dt><code><b>Uint8 default_size(magic_api * api, int which)</b></code></dt>
<dd> <dd>
<p> <p>
Return the default size the 'Magic' tool accepts. This will be the default setting for the tool the first time it is used during a Tux Paint session. If Tux Paint is being invoked with the sizing option disabled, this will be the only size requested by Tux Paint. Return a number between '1' and the amount you returned in <code>accepted_sizes()</code>. </p> Return the default size the 'Magic' tool accepts. This will be the default setting for the tool the first time it is used during a Tux Paint session. If Tux Paint is being invoked with the sizing option disabled, this will be the only size requested by Tux Paint. Return a number between '1' and the amount you returned in <code>accepted_sizes()</code>. </p>

View file

@ -310,7 +310,7 @@ Magic Tool Plugin API Documentation
Note: Called once for each Magic tool your plugin claims to Note: Called once for each Magic tool your plugin claims to
contain (by your "get_tool_count()"). contain (by your "get_tool_count()").
int accepted_sizes(magic_api * api, int which) Uint8 accepted_sizes(magic_api * api, int which)
Return how many size variations the 'Magic' tool accepts. Return a Return how many size variations the 'Magic' tool accepts. Return a
'0' if the 'Magic' tool should not offer sizing options. Returning '0' if the 'Magic' tool should not offer sizing options. Returning
@ -319,7 +319,7 @@ Magic Tool Plugin API Documentation
Note: Called once for each Magic tool your plugin claims to Note: Called once for each Magic tool your plugin claims to
contain (by your "get_tool_count()"). contain (by your "get_tool_count()").
int default_size(magic_api * api, int which) Uint8 default_size(magic_api * api, int which)
Return the default size the 'Magic' tool accepts. This will be the Return the default size the 'Magic' tool accepts. This will be the
default setting for the tool the first time it is used during a default setting for the tool the first time it is used during a

View file

@ -393,7 +393,7 @@
<b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p> <b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p>
</dd> </dd>
<dt><code><b>int accepted_sizes(magic_api * api, int which)</b></code></dt> <dt><code><b>Uint8 accepted_sizes(magic_api * api, int which)</b></code></dt>
<dd> <dd>
<p> <p>
Return how many size variations the 'Magic' tool accepts. Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'. </p> Return how many size variations the 'Magic' tool accepts. Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'. </p>
@ -401,7 +401,7 @@
<b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p> <b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p>
</dd> </dd>
<dt><code><b>int default_size(magic_api * api, int which)</b></code></dt> <dt><code><b>Uint8 default_size(magic_api * api, int which)</b></code></dt>
<dd> <dd>
<p> <p>
Return the default size the 'Magic' tool accepts. This will be the default setting for the tool the first time it is used during a Tux Paint session. If Tux Paint is being invoked with the sizing option disabled, this will be the only size requested by Tux Paint. Return a number between '1' and the amount you returned in <code>accepted_sizes()</code>. </p> Return the default size the 'Magic' tool accepts. This will be the default setting for the tool the first time it is used during a Tux Paint session. If Tux Paint is being invoked with the sizing option disabled, this will be the only size requested by Tux Paint. Return a number between '1' and the amount you returned in <code>accepted_sizes()</code>. </p>

View file

@ -310,7 +310,7 @@ Magic Tool Plugin API Documentation
Note: Called once for each Magic tool your plugin claims to Note: Called once for each Magic tool your plugin claims to
contain (by your "get_tool_count()"). contain (by your "get_tool_count()").
int accepted_sizes(magic_api * api, int which) Uint8 accepted_sizes(magic_api * api, int which)
Return how many size variations the 'Magic' tool accepts. Return a Return how many size variations the 'Magic' tool accepts. Return a
'0' if the 'Magic' tool should not offer sizing options. Returning '0' if the 'Magic' tool should not offer sizing options. Returning
@ -319,7 +319,7 @@ Magic Tool Plugin API Documentation
Note: Called once for each Magic tool your plugin claims to Note: Called once for each Magic tool your plugin claims to
contain (by your "get_tool_count()"). contain (by your "get_tool_count()").
int default_size(magic_api * api, int which) Uint8 default_size(magic_api * api, int which)
Return the default size the 'Magic' tool accepts. This will be the Return the default size the 'Magic' tool accepts. This will be the
default setting for the tool the first time it is used during a default setting for the tool the first time it is used during a

View file

@ -393,7 +393,7 @@
<b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p> <b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p>
</dd> </dd>
<dt><code><b>int accepted_sizes(magic_api * api, int which)</b></code></dt> <dt><code><b>Uint8 accepted_sizes(magic_api * api, int which)</b></code></dt>
<dd> <dd>
<p> <p>
Return how many size variations the 'Magic' tool accepts. Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'. </p> Return how many size variations the 'Magic' tool accepts. Return a '0' if the 'Magic' tool should not offer sizing options. Returning '1' is the same as returning '0'. </p>
@ -401,7 +401,7 @@
<b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p> <b>Note:</b> Called once for each Magic tool your plugin claims to contain (by your "<code>get_tool_count()</code>"). </p>
</dd> </dd>
<dt><code><b>int default_size(magic_api * api, int which)</b></code></dt> <dt><code><b>Uint8 default_size(magic_api * api, int which)</b></code></dt>
<dd> <dd>
<p> <p>
Return the default size the 'Magic' tool accepts. This will be the default setting for the tool the first time it is used during a Tux Paint session. If Tux Paint is being invoked with the sizing option disabled, this will be the only size requested by Tux Paint. Return a number between '1' and the amount you returned in <code>accepted_sizes()</code>. </p> Return the default size the 'Magic' tool accepts. This will be the default setting for the tool the first time it is used during a Tux Paint session. If Tux Paint is being invoked with the sizing option disabled, this will be the only size requested by Tux Paint. Return a number between '1' and the amount you returned in <code>accepted_sizes()</code>. </p>

View file

@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt) (See COPYING.txt)
Last updated: February 12, 2023 Last updated: April 11, 2023
*/ */
#include <stdio.h> #include <stdio.h>
@ -36,6 +36,7 @@
static Mix_Chunk *kalidescope_snd; static Mix_Chunk *kalidescope_snd;
static Uint8 kalidescope_r, kalidescope_g, kalidescope_b; static Uint8 kalidescope_r, kalidescope_g, kalidescope_b;
static Uint8 kalidescope_sz = 8; // FIXME: Not necessary
static int square_size = 128; static int square_size = 128;
@ -79,8 +80,12 @@ void kalidescope_release(magic_api * api, int which, SDL_Surface * canvas,
SDL_Rect * update_rect); SDL_Rect * update_rect);
void kalidescope_shutdown(magic_api * api); void kalidescope_shutdown(magic_api * api);
int kalidescope_requires_colors(magic_api * api, int which); int kalidescope_requires_colors(magic_api * api, int which);
Uint8 kalidescope_accepted_sizes(magic_api * api, int which);
Uint8 kalidescope_default_size(magic_api * api, int which);
void kalidescope_set_color(magic_api * api, int which, SDL_Surface * canvas, void kalidescope_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect); SDL_Surface * last, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect);
void kalidescope_set_size(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, Uint8 sz, SDL_Rect * update_rect);
void kalidescope_switchin(magic_api * api, int which, int mode, void kalidescope_switchin(magic_api * api, int which, int mode,
SDL_Surface * canvas); SDL_Surface * canvas);
void kalidescope_switchout(magic_api * api, int which, int mode, void kalidescope_switchout(magic_api * api, int which, int mode,
@ -202,11 +207,11 @@ static void do_kalidescope(void *ptr, int which, SDL_Surface * canvas,
colr = colr =
SDL_MapRGB(canvas->format, kalidescope_r, kalidescope_g, kalidescope_b); SDL_MapRGB(canvas->format, kalidescope_r, kalidescope_g, kalidescope_b);
for (yy = -8; yy < 8; yy++) for (yy = -kalidescope_sz; yy < kalidescope_sz; yy++)
{ {
for (xx = -8; xx < 8; xx++) for (xx = -kalidescope_sz; xx < kalidescope_sz; xx++)
{ {
if (api->in_circle(xx, yy, 8)) if (api->in_circle(xx, yy, kalidescope_sz))
{ {
api->putpixel(canvas, x + xx, y + yy, colr); api->putpixel(canvas, x + xx, y + yy, colr);
@ -282,6 +287,13 @@ void kalidescope_shutdown(magic_api * api ATTRIBUTE_UNUSED)
Mix_FreeChunk(kalidescope_snd); Mix_FreeChunk(kalidescope_snd);
} }
// Use colors:
int kalidescope_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED)
{
return 1;
}
// Record the color from Tux Paint: // Record the color from Tux Paint:
void kalidescope_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED, void kalidescope_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect ATTRIBUTE_UNUSED) SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
@ -291,13 +303,27 @@ void kalidescope_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE
kalidescope_b = b; kalidescope_b = b;
} }
// Use colors: // Use sizes:
int kalidescope_requires_colors(magic_api * api ATTRIBUTE_UNUSED, Uint8 kalidescope_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED) int which ATTRIBUTE_UNUSED)
{ {
return 1; return 6;
} }
Uint8 kalidescope_default_size(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED)
{
return 4;
}
// Record the size from Tux Paint:
void kalidescope_set_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 sz, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
{
kalidescope_sz = (sz * 2);
}
void kalidescope_switchin(magic_api * api ATTRIBUTE_UNUSED, void kalidescope_switchin(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
int mode ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,

View file

@ -1420,6 +1420,8 @@ static int stamp_size_override = -1;
static int no_stamp_rotation = 0; static int no_stamp_rotation = 0;
static int new_colors_last; static int new_colors_last;
static Uint8 magic_disabled_features = 0x00000000;
#ifdef NOKIA_770 #ifdef NOKIA_770
static int simple_shapes = 1; static int simple_shapes = 1;
#else #else
@ -1562,9 +1564,12 @@ typedef struct magic_funcs_s
SDL_Surface *(*get_icon)(magic_api *, int); SDL_Surface *(*get_icon)(magic_api *, int);
char *(*get_description)(magic_api *, int, int); char *(*get_description)(magic_api *, int, int);
int (*requires_colors)(magic_api *, int); int (*requires_colors)(magic_api *, int);
Uint8 (*accepted_sizes)(magic_api *, int);
Uint8 (*default_size)(magic_api *, int);
int (*modes)(magic_api *, int); int (*modes)(magic_api *, int);
void (*set_color)(magic_api *, int, SDL_Surface *, SDL_Surface *, Uint8, Uint8, Uint8, SDL_Rect *); void (*set_color)(magic_api *, int, SDL_Surface *, SDL_Surface *, Uint8, Uint8, Uint8, SDL_Rect *);
int (*init)(magic_api *); void (*set_size)(magic_api *, int, SDL_Surface *, SDL_Surface *, Uint8, SDL_Rect *);
int (*init)(magic_api *, Uint32);
Uint32(*api_version) (void); Uint32(*api_version) (void);
void (*shutdown)(magic_api *); void (*shutdown)(magic_api *);
void (*click)(magic_api *, int, int, SDL_Surface *, SDL_Surface *, int, int, void (*click)(magic_api *, int, int, SDL_Surface *, SDL_Surface *, int, int,
@ -1586,6 +1591,9 @@ typedef struct magic_s
int mode; /* Current mode (paint or fullscreen) */ int mode; /* Current mode (paint or fullscreen) */
int avail_modes; /* Available modes (paint &/or fullscreen) */ int avail_modes; /* Available modes (paint &/or fullscreen) */
int colors; /* Whether magic tool accepts colors */ int colors; /* Whether magic tool accepts colors */
int sizes; /* Whether magic tool accepts sizes */
int default_size; /* Magic tool's default size setting */
int size; /* Magic tool's size setting */
int group; /* Which group of magic tools this lives in */ int group; /* Which group of magic tools this lives in */
char *name; /* Name of magic tool */ char *name; /* Name of magic tool */
char *tip[MAX_MODES]; /* Description of magic tool, in each possible mode */ char *tip[MAX_MODES]; /* Description of magic tool, in each possible mode */
@ -22425,6 +22433,16 @@ static void load_magic_plugins(void)
magic_funcs[num_plugin_files].requires_colors = magic_funcs[num_plugin_files].requires_colors =
SDL_LoadFunction(magic_handle[num_plugin_files], funcname); SDL_LoadFunction(magic_handle[num_plugin_files], funcname);
safe_snprintf(funcname, sizeof(funcname), "%s_%s", objname,
"accepted_sizes");
magic_funcs[num_plugin_files].accepted_sizes =
SDL_LoadFunction(magic_handle[num_plugin_files], funcname);
safe_snprintf(funcname, sizeof(funcname), "%s_%s", objname,
"default_size");
magic_funcs[num_plugin_files].default_size =
SDL_LoadFunction(magic_handle[num_plugin_files], funcname);
safe_snprintf(funcname, sizeof(funcname), "%s_%s", objname, safe_snprintf(funcname, sizeof(funcname), "%s_%s", objname,
"modes"); "modes");
magic_funcs[num_plugin_files].modes = magic_funcs[num_plugin_files].modes =
@ -22435,6 +22453,11 @@ static void load_magic_plugins(void)
magic_funcs[num_plugin_files].set_color = magic_funcs[num_plugin_files].set_color =
SDL_LoadFunction(magic_handle[num_plugin_files], funcname); SDL_LoadFunction(magic_handle[num_plugin_files], funcname);
safe_snprintf(funcname, sizeof(funcname), "%s_%s", objname,
"set_size");
magic_funcs[num_plugin_files].set_size =
SDL_LoadFunction(magic_handle[num_plugin_files], funcname);
safe_snprintf(funcname, sizeof(funcname), "%s_%s", objname, safe_snprintf(funcname, sizeof(funcname), "%s_%s", objname,
"init"); "init");
magic_funcs[num_plugin_files].init = magic_funcs[num_plugin_files].init =
@ -22492,11 +22515,20 @@ static void load_magic_plugins(void)
DEBUG_PRINTF("requires_colors = 0x%x\n", DEBUG_PRINTF("requires_colors = 0x%x\n",
(int) (intptr_t) (int) (intptr_t)
magic_funcs[num_plugin_files].requires_colors); magic_funcs[num_plugin_files].requires_colors);
DEBUG_PRINTF("accepted_sizes = 0x%x\n",
(int) (intptr_t)
magic_funcs[num_plugin_files].accepted_sizes);
DEBUG_PRINTF("default_size = 0x%x\n",
(int) (intptr_t)
magic_funcs[num_plugin_files].default_size);
DEBUG_PRINTF("modes = 0x%x\n", DEBUG_PRINTF("modes = 0x%x\n",
(int) (intptr_t) magic_funcs[num_plugin_files].modes); (int) (intptr_t) magic_funcs[num_plugin_files].modes);
DEBUG_PRINTF("set_color = 0x%x\n", DEBUG_PRINTF("set_color = 0x%x\n",
(int) (intptr_t) (int) (intptr_t)
magic_funcs[num_plugin_files].set_color); magic_funcs[num_plugin_files].set_color);
DEBUG_PRINTF("set_size = 0x%x\n",
(int) (intptr_t)
magic_funcs[num_plugin_files].set_size);
DEBUG_PRINTF("init = 0x%x\n", DEBUG_PRINTF("init = 0x%x\n",
(int) (intptr_t) magic_funcs[num_plugin_files].init); (int) (intptr_t) magic_funcs[num_plugin_files].init);
DEBUG_PRINTF("api_version = 0x%x\n", DEBUG_PRINTF("api_version = 0x%x\n",
@ -22557,6 +22589,20 @@ static void load_magic_plugins(void)
fname); fname);
err = 1; err = 1;
} }
if (magic_funcs[num_plugin_files].accepted_sizes == NULL)
{
fprintf(stderr,
"Error: plugin %s is missing accepted_sizes\n",
fname);
err = 1;
}
if (magic_funcs[num_plugin_files].default_size == NULL)
{
fprintf(stderr,
"Error: plugin %s is missing default_size\n",
fname);
err = 1;
}
if (magic_funcs[num_plugin_files].modes == NULL) if (magic_funcs[num_plugin_files].modes == NULL)
{ {
fprintf(stderr, "Error: plugin %s is missing modes\n", fname); fprintf(stderr, "Error: plugin %s is missing modes\n", fname);
@ -22568,6 +22614,12 @@ static void load_magic_plugins(void)
fname); fname);
err = 1; err = 1;
} }
if (magic_funcs[num_plugin_files].set_size == NULL)
{
fprintf(stderr, "Error: plugin %s is missing set_size\n",
fname);
err = 1;
}
if (magic_funcs[num_plugin_files].init == NULL) if (magic_funcs[num_plugin_files].init == NULL)
{ {
fprintf(stderr, "Error: plugin %s is missing init\n", fname); fprintf(stderr, "Error: plugin %s is missing init\n", fname);
@ -22630,7 +22682,7 @@ static void load_magic_plugins(void)
} }
else else
{ {
res = magic_funcs[num_plugin_files].init(magic_api_struct); res = magic_funcs[num_plugin_files].init(magic_api_struct, magic_disabled_features);
if (res != 0) if (res != 0)
n = n =
@ -31281,6 +31333,11 @@ static void setup(void)
/* Load magic tool plugins: */ /* Load magic tool plugins: */
magic_disabled_features = 0x00000000;
if (0) { /* FIXME */
magic_disabled_features |= MAGIC_FEATURE_SIZE;
}
load_magic_plugins(); load_magic_plugins();
show_progress_bar(screen); show_progress_bar(screen);