当前位置: 首页 > news >正文

0元开网店一件代发杭州seo外包

0元开网店一件代发,杭州seo外包,安徽省建设厅官网,数字城市建设网站一、模拟器源码 源码:https://files.cnblogs.com/files/twzy/arm-NES-linux-master.zip 二、文件系统 文件系统:debian bullseye 使用builtroot2018构建的文件系统,使用InfoNES模拟器存在bug,搞不定,所以放弃&…

一、模拟器源码

源码:https://files.cnblogs.com/files/twzy/arm-NES-linux-master.zip

二、文件系统

文件系统:debian bullseye

使用builtroot2018构建的文件系统,使用InfoNES模拟器存在bug,搞不定,所以放弃,改用debian。

三、编译

在debian文件系统下编译,在f1c200s开发板执行

解压源码进入Linux目录,不用做修改执行make编译。

编译后在f1c200s开发板执行,屏幕可见画面。

启动debian模拟器

mount_debian.sh

#/bin/bash
cd rootfs
sudo mount --bind /dev dev/
sudo mount --bind /sys sys/
sudo mount --bind /proc proc/
sudo mount --bind /dev/pts dev/pts/
sudo cp /usr/bin/qemu-arm-static  usr/bin/
cd ..
sudo LC_ALL=C LANGUAGE=C LANG=C chroot rootfs

编译:

cd /home/arm-NES-linux/linux && make

退出debian模拟器

unmount_debian.sh

sudo rm rootfs/usr/bin/qemu-arm-static #删除之前拷贝的文件
cd rootfs
sudo umount   dev/pts/ # 一定要在/dev前面umount
sudo umount   dev/
sudo umount   sys/
sudo umount   proc/

四、适配遥控

builtroot制作的文件系统下调试驱动。

在debian系统下使用:evtest命令

这里使用无线手柄:

在命令行执行:evtest,操作无线手柄可发现有按键事件上报。

image-20240709202212982

修改NES模拟器源码linux目录下的joypad_input.cpp,使其适配自己的无线手柄。

修改一

int InitJoypadInput(void)
{int iErr = 0;//iErr = RegisterJoypadInput(&joypadInput);iErr = RegisterJoypadInput(&usbJoypadInput);    // 只注册这个输入return iErr;
}

修改二

static int USBjoypadGet(void)
{/*** FC手柄 bit 键位对应关系 真实手柄中有一个定时器,处理 连A  连B * 0  1   2       3       4    5      6     7* A  B   Select  Start  Up   Down   Left  Right*///因为 USB 手柄每次只能读到一位键值 所以要有静态变量保存上一次的值static unsigned char joypad = 0;struct input_event e;if(0 < read (USBjoypad_fd, &e, sizeof(e))){if(0x3 == e.type){/*上:value:0x8001 type:0x2 number:0x5value:0x0 type:0x2 number:0x5*/if(17 == e.code && -1 == e.value){joypad |= 1<<4;}/*下:value:0x7fff type:0x2 number:0x5value:0x0 type:0x2 number:0x5*/if(17 == e.code && 1 == e.value){joypad |= 1<<5;}//松开if(17 == e.code && 0 == e.value){joypad &= ~(1<<4 | 1<<5);}/*左:value:0x8001 type:0x2 number:0x4value:0x0 type:0x2 number:0x4*/if(16 == e.code && -1 == e.value){joypad |= 1<<6;}/*右:value:0x7fff type:0x2 number:0x4value:0x0 type:0x2 number:0x4*/if(16 == e.code && 1 == e.value){joypad |= 1<<7;}//松开if(16 == e.code && 0 == e.value){joypad &= ~(1<<6 | 1<<7);}}if(0x1 == e.type){/*选择:value:0x1 type:0x1 number:0xavalue:0x0 type:0x1 number:0xa*/if(314 == e.code && 1 == e.value){joypad |= 1<<2;}if(314 == e.code && 0 == e.value){joypad &= ~(1<<2);}/*开始value:0x1 type:0x1 number:0xbvalue:0x0 type:0x1 number:0xb*/if(315 == e.code && 1 == e.value){joypad |= 1<<3;}if(315 == e.code && 0 == e.value){joypad &= ~(1<<3);}/*Avalue:0x1 type:0x1 number:0x0value:0x0 type:0x1 number:0x0*/if(304 == e.code && 1 == e.value){joypad |= 1<<0;}if(304 == e.code && 0 == e.value){joypad &= ~(1<<0);}/*Bvalue:0x1 type:0x1 number:0x1value:0x0 type:0x1 number:0x1*/if(305 == e.code && 1 == e.value){joypad |= 1<<1;}if(305 == e.code && 0 == e.value){joypad &= ~(1<<1);}/*Xvalue:0x1 type:0x1 number:0x3value:0x0 type:0x1 number:0x3*/if(307 == e.code && 1 == e.value){joypad |= 1<<0;}if(307 == e.code && 0 == e.value){joypad &= ~(1<<0);}/*Yvalue:0x1 type:0x1 number:0x4value:0x0 type:0x1 number:0x4*/if(308 == e.code && 1 == e.value){joypad |= 1<<1;}if(308 == e.code && 0 == e.value){joypad &= ~(1<<1);}}return joypad;}return -1;
}

修改三

static void *InputEventTreadFunction(void *pVoid)
{/* 定义函数指针 */int (*GetJoypad)(void);GetJoypad = (int (*)(void))pVoid;while (1){//因为有阻塞所以没有输入时是休眠//g_InputEvent = GetJoypad();int data = GetJoypad();if (data == -1){continue;}else{g_InputEvent = data;}//有数据时唤醒pthread_mutex_lock(&g_tMutex);//因为有阻塞所以没有输入时是休眠pthread_cond_signal(&g_tConVar);pthread_mutex_unlock(&g_tMutex);}
}

五、测试游戏是否可以正常玩耍

可以无声音畅玩了。

image-20240708200227768

六、先解决debian系统下的语音播放

检查声卡

cat /proc/asound/cards

默认声卡配置

vi /etc/asound.conf

defaults.ctl.card 0
defaults.pcm.card 0
defaults.timer.card 0
amixer controls 用于查看音频系统提供的操作接口
amixer contents 用于查看接口配置参数
amixer cget + 接口函数
amixer cset + 接口函数 + 设置值amixer cget numid=14,iface=MIXER,name='ADC Mixer Mic Capture Switch'
amixer cset numid=14,iface=MIXER,name='ADC Mixer Mic Capture Switch' on
打开之后才可以录音
arecord out.wav
root@wang-virtual-machine:~# arecord out.wav
Recording WAVE 'out.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
^CAborted by signal Interrupt...
root@wang-virtual-machine:~#
root@wang-virtual-machine:~#
root@wang-virtual-machine:~# aplay out.wav
Playing WAVE 'out.wav' : Unsigned 8 bit, Rate 8000 Hz, Mono
^CAborted by signal Interrupt...

七、解决NES模拟器的声音

启动游戏会出现乱七八糟的声音,也不知道对不对。在NES中是通过一些PCM的API操作音频的,具体的看代码吧。

八、mplayer播放音频

mplayer -ao alsa out.wav 特别慢有声音

mplayer -ao alsa test.wav

mplayer -ao alsa test.mp3

root@wang-virtual-machine:/home# mplayer -ao alsa test.mp3
MPlayer 1.4 (Debian), built with gcc-10 (C) 2000-2019 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.Playing test.mp3.
libavformat version 58.45.100 (external)
Audio only file format detected.
Load subtitles in ./
==========================================================================
Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
AUDIO: 16000 Hz, 2 ch, s16le, 16.0 kbit/3.12% (ratio: 2000->64000)
Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
==========================================================================
AO: [alsa] 16000Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:   3.1 (03.0) of 3.0 (03.0) 12.7%Exiting... (End of file)

有办法去掉connect to socket吗?

是遥控器,通过配置去掉。

vi /etc/mplayer/mplayer.conf
lirc=no

但依然还是很慢。能正常使用。

九、参考

https://zhuanlan.zhihu.com/p/670785159

http://www.hkea.cn/news/857165/

相关文章:

  • ae有么有做gif的网站品牌推广方案范文
  • apicloud官网下载seo关键词优化排名公司
  • 上海网站制作福州百度关键字优化精灵
  • 做uml图网站百度账号快速注册入口
  • 广西梧州南京 seo 价格
  • 网站警察备案seo关键词优化平台
  • 网站开发设计实训 报告惠州网站建设
  • 网站开发的原理山西免费网站关键词优化排名
  • 石家庄网站建设全包免费推广网站2024
  • 阿里云网站备案时间无锡seo网站管理
  • 景点介绍网站模板重庆百度关键词推广
  • 做亚马逊网站费用吗曲靖新闻今日头条
  • bing 网站管理员2023今日新闻头条
  • 深圳市做网站前十强百度一下搜索网页
  • 做执法设备有哪些网站国家免费培训学校
  • 顺德乐从有做阿里巴巴的网站吗杭州网站设计
  • 做英文网站 用阿里服务器行吗b2b网站推广排名
  • 搭建网站做淘宝客网赌怎么推广拉客户
  • 网站建设前台与后台最新技术2021最新免费的推广引流软件
  • 做网站基本语言淘宝如何提升关键词排名
  • wordpress怎样分类目录添加标签seo文章范文
  • 订阅号可以做网站吗南宁seo外包服务商
  • 邢台哪儿做网站便宜宁波 seo排名公司
  • 深圳网站优化咨询网上广告怎么推广
  • 网站右击无效是怎么做的网络营销产品
  • 中宣部网站政治建设网站服务器是什么意思
  • 淮安网站定制徐州seo外包公司
  • 嘉兴类网站系统总部网站建设技术解决方案
  • 做网站的教科书外包网络推广公司推广网站
  • 模板名字 wordpress优化大师如何删掉多余的学生