MAMEWorld >> Programming
Index   Flat Mode Flat  

sz72
MAME Fan
Reged: 08/20/07
Posts: 78
Send PM
Re: Need help with Cruis'n World driver
08/28/12 01:30 PM


> Thanks for the answer
>
> If i insert the "return" between braces, like
>
>
> static READ32_HANDLER( port1_r )
> {
> UINT16 viewval = readinputport(1);
> UINT16 viewdiff = viewval ^ last_port1;
> if ((viewdiff & 0x0010) && !(viewval & 0x0010))
> {
> if (view_state==0) {view_state = 4;} //1st view
> else if (view_state==4) {view_state = 2;} //2nd view
> else if (view_state==2) {view_state = 1;} //3rd view
> else if (view_state==1) {view_state = 4;} //1st view
> last_port1 = viewval;
> viewval = (viewval | 0x00f0) ^ (view_state << 4);
> return (viewval << 16) | viewval;
> }
> }
>
> While compiling it reports an error to the last line (that with the closing brace):
> "control reaches end of non-void function"
>
> How should i write it? Maybe it needs something to be returned before closing ?
>
> Thanks a lot

"non-void function" means "function that must always return a value"
With your modification port1_r returns a value only when the button is pressed (released), so the compiler gives you that error
READ32_HANDLER generates a function that must return a 32 bit number (as the term "read handler" suggests)







Entire thread
Subject Posted by Posted on
* Need help with Cruis'n World driver baritonomarchetto 08/27/12 04:12 PM
. * Re: Need help with Cruis'n World driver sz72  08/27/12 08:44 PM
. * Re: Need help with Cruis'n World driver baritonomarchetto  08/28/12 09:23 AM
. * Re: Need help with Cruis'n World driver sz72  08/28/12 01:30 PM
. * Re: Need help with Cruis'n World driver baritonomarchetto  08/28/12 02:01 PM
. * Re: Need help with Cruis'n World driver sz72  08/28/12 03:51 PM
. * Re: Need help with Cruis'n World driver baritonomarchetto  08/28/12 04:19 PM
. * Re: Need help with Cruis'n World driver sz72  08/28/12 06:55 PM
. * Re: Need help with Cruis'n World driver baritonomarchetto  08/29/12 02:27 PM
. * Re: Need help with Cruis'n World driver etabeta  08/29/12 04:04 PM
. * Re: Need help with Cruis'n World driver baritonomarchetto  08/29/12 04:37 PM
. * Re: Need help with Cruis'n World driver etabeta  08/30/12 07:32 AM
. * Re: Need help with Cruis'n World driver baritonomarchetto  08/30/12 05:54 PM
. * Re: Need help with Cruis'n World driver etabeta  08/31/12 08:27 AM
. * Re: Need help with Cruis'n World driver baritonomarchetto  09/03/12 07:21 PM
. * Re: Need help with Cruis'n World driver any  09/06/12 06:04 AM
. * Re: Need help with Cruis'n World driver baritonomarchetto  09/06/12 02:52 PM
. * Re: Need help with Cruis'n World driver any  09/07/12 05:52 AM
. * Re: Need help with Cruis'n World driver baritonomarchetto  09/10/12 02:19 PM
. * Re: Need help with Cruis'n World driver baritonomarchetto  09/13/12 05:05 PM
. * Re: Need help with Cruis'n World driver R. Belmont  09/18/12 05:05 PM
. * Re: Need help with Cruis'n World driver baritonomarchetto  09/18/12 05:28 PM

Extra information Permissions
Moderator:  Pi 
0 registered and 38 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 4482